Merge pull request #341 from Icinga:fix/various_director_imc_fixes

Fix: Various issues with Icinga Director on IMC

Adds various fixes and improvements for the Icinga Director Self-Service API while using IMC.
This commit is contained in:
Lord Hepipud 2021-08-19 14:20:54 +02:00 committed by GitHub
commit 25578d0d50
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 44 additions and 23 deletions

View file

@ -17,6 +17,8 @@ function Install-Icinga()
'LastNotice' = '';
'LastError' = '';
'HeaderPreview' = '';
'DirectorSelfService' = $FALSE;
'DirectorRegisteredHost' = $FALSE;
'LastParent' = [System.Collections.ArrayList]@();
'LastValues' = @();
'Config' = @{ };

View file

@ -15,6 +15,7 @@ function Resolve-IcingaForWindowsManagementConsoleInstallationDirectorTemplate()
Add-IcingaForWindowsInstallerConfigEntry -Selection 'c' -Values $DirectorUrl -OverwriteValues -OverwriteMenu 'Show-IcingaForWindowsManagementConsoleInstallationEnterDirectorUrl';
Add-IcingaForWindowsInstallerConfigEntry -Selection 'c' -Values $SelfServiceKey -OverwriteValues -OverwriteMenu 'Show-IcingaForWindowsManagementConsoleInstallationEnterDirectorSelfServiceKey';
} else {
$Global:Icinga.InstallWizard.DirectorRegisteredHost = $TRUE;
$HostnameType = Get-IcingaForWindowsInstallerStepSelection -InstallerStep 'Show-IcingaForWindowsInstallerMenuSelectHostname';
$Hostname = '';
@ -76,7 +77,7 @@ function Resolve-IcingaForWindowsManagementConsoleInstallationDirectorTemplate()
$ServiceUserName = $DirectorConfig.icinga_service_user;
$AgentPackageSelection = 1; #Always use custom source
$AgentPackageSource = $DirectorConfig.download_url;
$AgentVersion = $DirectorConfig.release;
$AgentVersion = $DirectorConfig.agent_version;
$IcingaPort = $DirectorConfig.agent_listen_port;
$GlobalZones = @();
$IcingaParents = @();
@ -174,6 +175,13 @@ function Resolve-IcingaForWindowsManagementConsoleInstallationDirectorTemplate()
}
Disable-IcingaFrameworkConsoleOutput;
$HostRegisterSetting = (Get-IcingaForWindowsInstallerStepSelection -InstallerStep 'Show-IcingaForWindowsInstallerMenuSelectHostname');
if ($null -ne $HostRegisterSetting -And $HostnameSelection -ne $HostRegisterSetting) {
$HostnameSelection = $HostRegisterSetting;
}
Show-IcingaForWindowsInstallerMenuSelectHostname -DefaultInput $HostnameSelection -Automated;
Add-IcingaForWindowsInstallationAdvancedEntries;
Disable-IcingaFrameworkConsoleOutput;
@ -194,6 +202,8 @@ function Resolve-IcingaForWindowsManagementConsoleInstallationDirectorTemplate()
Show-IcingaForWindowsInstallerMenuSelectCertificate -Automated -DefaultInput '1';
Show-IcingaForWindowsInstallerMenuEnterIcingaTicket -Automated -Value $Ticket;
Show-IcingaForWindowsInstallationMenuEnterIcingaAgentVersion -Automated -Value $AgentVersion;
Show-IcingaForWindowsManagementConsoleInstallationDirectorRegisterHost -Automated;
Enable-IcingaFrameworkConsoleOutput;

View file

@ -8,6 +8,8 @@ function Show-IcingaForWindowsManagementConsoleInstallationEnterDirectorUrl()
[switch]$Advanced = $FALSE
);
$Global:Icinga.InstallWizard.DirectorSelfService = $TRUE;
Show-IcingaForWindowsInstallerMenu `
-Header 'Please enter the URL pointing to your Icinga Director module:' `
-Entries @(

View file

@ -1,5 +1,10 @@
function Show-IcingaForWindowsInstallerMenuFinishInstaller()
{
if ($global:Icinga.InstallWizard.DirectorSelfService -eq $TRUE -And $global:Icinga.InstallWizard.DirectorRegisteredHost -eq $FALSE) {
$global:Icinga.InstallWizard.LastNotice = 'To install this host while using "Icinga Director Self-Service API", you need to register the host in the previous step first.';
}
Show-IcingaForWindowsInstallerMenu `
-Header 'How you do want to proceed:' `
-Entries @(
@ -7,7 +12,7 @@ function Show-IcingaForWindowsInstallerMenuFinishInstaller()
'Caption' = 'Start installation';
'Command' = 'Start-IcingaForWindowsInstallation';
'Help' = 'Apply the just configured configuration and install components as selected';
'Disabled' = (-Not ($global:Icinga.InstallWizard.AdminShell));
'Disabled' = (-Not ($global:Icinga.InstallWizard.AdminShell) -Or ($global:Icinga.InstallWizard.DirectorSelfService -eq $TRUE -And $global:Icinga.InstallWizard.DirectorRegisteredHost -eq $FALSE));
'Action' = @{
'Command' = 'Clear-IcingaForWindowsManagementConsolePaginationCache';
}

View file

@ -8,6 +8,8 @@ function Show-IcingaForWindowsInstallerMenuSelectConnection()
[switch]$Advanced = $FALSE
);
$Global:Icinga.InstallWizard.DirectorSelfService = $FALSE;
Show-IcingaForWindowsInstallerMenu `
-Header 'How do you want to configure your local Icinga Agent?' `
-Entries @(