Fixies various Icinga Director IMC issues

This commit is contained in:
Lord Hepipud 2021-08-19 14:19:22 +02:00
parent 227367999d
commit 4b7b86785f
5 changed files with 44 additions and 23 deletions

View file

@ -12,27 +12,29 @@ function Install-Icinga()
if ($global:Icinga.ContainsKey('InstallWizard') -eq $FALSE) { if ($global:Icinga.ContainsKey('InstallWizard') -eq $FALSE) {
$global:Icinga.Add( $global:Icinga.Add(
'InstallWizard', @{ 'InstallWizard', @{
'AdminShell' = (Test-AdministrativeShell); 'AdminShell' = (Test-AdministrativeShell);
'LastInput' = ''; 'LastInput' = '';
'LastNotice' = ''; 'LastNotice' = '';
'LastError' = ''; 'LastError' = '';
'HeaderPreview' = ''; 'HeaderPreview' = '';
'LastParent' = [System.Collections.ArrayList]@(); 'DirectorSelfService' = $FALSE;
'LastValues' = @(); 'DirectorRegisteredHost' = $FALSE;
'Config' = @{ }; 'LastParent' = [System.Collections.ArrayList]@();
'ConfigSwap' = @{ }; 'LastValues' = @();
'ParentConfig' = $null; 'Config' = @{ };
'Menu' = 'Install-Icinga'; 'ConfigSwap' = @{ };
'NextCommand' = ''; 'ParentConfig' = $null;
'NextArguments' = $null; 'Menu' = 'Install-Icinga';
'HeaderSelection' = $null; 'NextCommand' = '';
'DisplayAdvanced' = $FALSE; 'NextArguments' = $null;
'ShowAdvanced' = $FALSE; 'HeaderSelection' = $null;
'ShowHelp' = $FALSE; 'DisplayAdvanced' = $FALSE;
'DeleteValues' = $FALSE; 'ShowAdvanced' = $FALSE;
'HeaderPrint' = $FALSE; 'ShowHelp' = $FALSE;
'JumpToSummary' = $FALSE; 'DeleteValues' = $FALSE;
'Closing' = $FALSE; 'HeaderPrint' = $FALSE;
'JumpToSummary' = $FALSE;
'Closing' = $FALSE;
} }
); );
} }

View file

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

View file

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

View file

@ -1,5 +1,10 @@
function Show-IcingaForWindowsInstallerMenuFinishInstaller() 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 ` Show-IcingaForWindowsInstallerMenu `
-Header 'How you do want to proceed:' ` -Header 'How you do want to proceed:' `
-Entries @( -Entries @(
@ -7,7 +12,7 @@ function Show-IcingaForWindowsInstallerMenuFinishInstaller()
'Caption' = 'Start installation'; 'Caption' = 'Start installation';
'Command' = 'Start-IcingaForWindowsInstallation'; 'Command' = 'Start-IcingaForWindowsInstallation';
'Help' = 'Apply the just configured configuration and install components as selected'; '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' = @{ 'Action' = @{
'Command' = 'Clear-IcingaForWindowsManagementConsolePaginationCache'; 'Command' = 'Clear-IcingaForWindowsManagementConsolePaginationCache';
} }

View file

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