Adds support for hostname override for old installer

This commit is contained in:
moreamazingnick 2022-03-25 15:56:45 +01:00 committed by Lord Hepipud
parent 86f9e27a94
commit 2d02ef1baf
3 changed files with 10 additions and 2 deletions

View file

@ -41,6 +41,7 @@ Released closed milestones can be found on [GitHub](https://github.com/Icinga/ic
* [#40](https://github.com/Icinga/icinga-powershell-framework/issues/40) Adds support to set service recovery for the Icinga Agent and Icinga for Windows service, to restart them in case of a crash or error
* [#485](https://github.com/Icinga/icinga-powershell-framework/issues/485) Adds new style for performance data labels, to use the multi output format, allowing for better filtering and visualisation with InfluxDB and Grafana
* [#502](https://github.com/Icinga/icinga-powershell-framework/pull/502) Adds support for hostname override for old installer function `Start-IcingaAgentInstallWizard` [moreamazingnick]
* [#525](https://github.com/Icinga/icinga-powershell-framework/pull/525) Adds new developer mode for `icinga` command and improved cache handling, to ensure within `-DeveloperMode` and inside a VS Code environment, the framework cache file is never overwritten, while still all functions are loaded and imported.
* [#531](https://github.com/Icinga/icinga-powershell-framework/pull/531) Adds `Test-IcingaStateFile` and `Repair-IcingaStateFile`, which is integrated into `Test-IcingaAgent`, to ensure the Icinga Agent state file is healthy and not corrupt, causing the Icinga Agent to fail on start
* [#534](https://github.com/Icinga/icinga-powershell-framework/pull/534) Improves Icinga and Director configuration generator, by wrapping PowerShell arrays inside `@()` instead of simply writing them comma separated

View file

@ -5,7 +5,8 @@ function Start-IcingaAgentDirectorWizard()
[string]$SelfServiceAPIKey = $null,
$OverrideDirectorVars = $null,
[bool]$RunInstaller = $FALSE,
[switch]$ForceTemplateKey = $FALSE
[switch]$ForceTemplateKey = $FALSE,
[string]$Hostname = $null
);
[hashtable]$DirectorOverrideArgs = @{ }
@ -64,6 +65,7 @@ function Start-IcingaAgentDirectorWizard()
-DirectorUrl $DirectorUrl `
-SelfServiceAPIKey $TemplateKey `
-OverrideDirectorVars $OverrideDirectorVars `
-Hostname $Hostname `
-ForceTemplateKey;
}
} else {
@ -74,7 +76,7 @@ function Start-IcingaAgentDirectorWizard()
return Start-IcingaAgentDirectorWizard `
-SelfServiceAPIKey ((Get-IcingaAgentInstallerAnswerInput -Prompt 'Please re-enter your SelfService API Key for the Host-Template in case the key is no longer assigned to your host' -Default 'v' -DefaultInput $SelfServiceAPIKey).answer) `
-OverrideDirectorVars $OverrideDirectorVars;
-OverrideDirectorVars $OverrideDirectorVars -Hostname $Hostname;
}
}
@ -89,6 +91,10 @@ function Start-IcingaAgentDirectorWizard()
}
}
if($Hostname -ne $null){
$Arguments.Add('Hostname', $Hostname);
}
if ($HostKnown -eq $FALSE) {
while ($TRUE) {
[bool]$RegisterFailed = $FALSE;

View file

@ -213,6 +213,7 @@ function Start-IcingaAgentInstallWizard()
-DirectorUrl $DirectorUrl `
-SelfServiceAPIKey $SelfServiceAPIKey `
-OverrideDirectorVars $OverrideDirectorVars `
-Hostname $Hostname `
-RunInstaller $RunInstaller;
$Result = Set-IcingaWizardArgument -DirectorArgs $DirectorArgs -WizardArg 'DirectorUrl' -Value $DirectorUrl -InstallerArguments $InstallerArguments;