diff --git a/doc/100-General/10-Changelog.md b/doc/100-General/10-Changelog.md index 21cefcb..fd91813 100644 --- a/doc/100-General/10-Changelog.md +++ b/doc/100-General/10-Changelog.md @@ -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 diff --git a/lib/core/icingaagent/misc/Start-IcingaAgentDirectorWizard.psm1 b/lib/core/icingaagent/misc/Start-IcingaAgentDirectorWizard.psm1 index 6ef77c9..eb2d3b8 100644 --- a/lib/core/icingaagent/misc/Start-IcingaAgentDirectorWizard.psm1 +++ b/lib/core/icingaagent/misc/Start-IcingaAgentDirectorWizard.psm1 @@ -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; diff --git a/lib/core/icingaagent/misc/Start-IcingaAgentInstallWizard.psm1 b/lib/core/icingaagent/misc/Start-IcingaAgentInstallWizard.psm1 index 40c6640..af16969 100644 --- a/lib/core/icingaagent/misc/Start-IcingaAgentInstallWizard.psm1 +++ b/lib/core/icingaagent/misc/Start-IcingaAgentInstallWizard.psm1 @@ -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;