From a040873e317da63e21ddee98094c555d77967f65 Mon Sep 17 00:00:00 2001 From: Christian Stein Date: Wed, 11 Mar 2020 17:46:01 +0100 Subject: [PATCH] Fix Self-Service API key input prompt during install wizard, even if key is set Fixes #52 --- .../icingaagent/misc/Start-IcingaAgentDirectorWizard.psm1 | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/lib/core/icingaagent/misc/Start-IcingaAgentDirectorWizard.psm1 b/lib/core/icingaagent/misc/Start-IcingaAgentDirectorWizard.psm1 index 53b4556..c7f6c51 100644 --- a/lib/core/icingaagent/misc/Start-IcingaAgentDirectorWizard.psm1 +++ b/lib/core/icingaagent/misc/Start-IcingaAgentDirectorWizard.psm1 @@ -33,13 +33,16 @@ function Start-IcingaAgentDirectorWizard() } if ($ForceTemplateKey -eq $FALSE) { - $SelfServiceAPIKey = $LocalAPIKey; - if ([string]::IsNullOrEmpty($SelfServiceAPIKey)) { + if ([string]::IsNullOrEmpty($LocalAPIKey)) { $LegacyTokenPath = Join-Path -Path Get-IcingaAgentConfigDirectory -ChildPath 'icingadirector.token'; if (Test-Path $LegacyTokenPath) { $SelfServiceAPIKey = Get-Content -Path $LegacyTokenPath; Set-IcingaPowerShellConfig -Path 'IcingaDirector.SelfService.ApiKey' -Value $SelfServiceAPIKey; + } else { + $ForceTemplateKey = $TRUE; } + } else { + $SelfServiceAPIKey = $LocalAPIKey; } }