mirror of
https://github.com/Icinga/icinga-powershell-framework.git
synced 2025-12-20 23:00:35 -05:00
Merge pull request #256 from Icinga:fix/director_self_service_api_wizard
Fix: Self Service for removed hosts/keys inside Icinga Director Fixes error while using Icinga Director Self-Service API, in case the host or host API key was deleted inside the Icinga Director and the installation wizard was called with the correct template key, while the old host key was still present inside the Icinga for Windows configuration
This commit is contained in:
commit
b782d44242
2 changed files with 24 additions and 10 deletions
|
|
@ -25,6 +25,7 @@ Released closed milestones can be found on [GitHub](https://github.com/Icinga/ic
|
||||||
|
|
||||||
### Bugfixes
|
### Bugfixes
|
||||||
|
|
||||||
|
* [#231](https://github.com/Icinga/icinga-powershell-framework/issues/231) Fixes error while using Icinga Director Self-Service API, in case the host or host API key was deleted inside the Icinga Director and the installation wizard was called with the correct template key, while the old host key was still present inside the Icinga for Windows configuration
|
||||||
* [#232](https://github.com/Icinga/icinga-powershell-framework/pull/232) Fixes wrong encoding while using REST-Api checks experimental feature, and now forces UTF8
|
* [#232](https://github.com/Icinga/icinga-powershell-framework/pull/232) Fixes wrong encoding while using REST-Api checks experimental feature, and now forces UTF8
|
||||||
* [#240](https://github.com/Icinga/icinga-powershell-framework/pull/240) While filtering for certain services with `Get-IcingaServices`, there were some attributes missing from the collection. These are now added resulting in always correct output data.
|
* [#240](https://github.com/Icinga/icinga-powershell-framework/pull/240) While filtering for certain services with `Get-IcingaServices`, there were some attributes missing from the collection. These are now added resulting in always correct output data.
|
||||||
* [#245](https://github.com/Icinga/icinga-powershell-framework/pull/245) Fixes loading of `.pfx` certificates by properly checking the file type
|
* [#245](https://github.com/Icinga/icinga-powershell-framework/pull/245) Fixes loading of `.pfx` certificates by properly checking the file type
|
||||||
|
|
|
||||||
|
|
@ -5,10 +5,10 @@ function Start-IcingaAgentDirectorWizard()
|
||||||
[string]$SelfServiceAPIKey = $null,
|
[string]$SelfServiceAPIKey = $null,
|
||||||
$OverrideDirectorVars = $null,
|
$OverrideDirectorVars = $null,
|
||||||
[bool]$RunInstaller = $FALSE,
|
[bool]$RunInstaller = $FALSE,
|
||||||
[switch]$ForceTemplateKey
|
[switch]$ForceTemplateKey = $FALSE
|
||||||
);
|
);
|
||||||
|
|
||||||
[hashtable]$DirectorOverrideArgs = @{}
|
[hashtable]$DirectorOverrideArgs = @{ }
|
||||||
if ([string]::IsNullOrEmpty($DirectorUrl)) {
|
if ([string]::IsNullOrEmpty($DirectorUrl)) {
|
||||||
$DirectorUrl = (Get-IcingaAgentInstallerAnswerInput -Prompt 'Please specify the Url pointing to your Icinga Director (Example: "https://example.com/icingaweb2/director")' -Default 'v').answer;
|
$DirectorUrl = (Get-IcingaAgentInstallerAnswerInput -Prompt 'Please specify the Url pointing to your Icinga Director (Example: "https://example.com/icingaweb2/director")' -Default 'v').answer;
|
||||||
}
|
}
|
||||||
|
|
@ -54,15 +54,28 @@ function Start-IcingaAgentDirectorWizard()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
if ([string]::IsNullOrEmpty($LocalAPIKey) -eq $FALSE -And $LocalAPIKey -ne $TemplateKey -And $ForceTemplateKey -eq $FALSE) {
|
||||||
$Arguments = Get-IcingaDirectorSelfServiceConfig -DirectorUrl $DirectorUrl -ApiKey $SelfServiceAPIKey;
|
try {
|
||||||
} catch {
|
$Arguments = Get-IcingaDirectorSelfServiceConfig -DirectorUrl $DirectorUrl -ApiKey $LocalAPIKey;
|
||||||
Write-IcingaConsoleError ([string]::Format('Failed to connect to your Icinga Director at "{0}". Please try again', $DirectorUrl));
|
} catch {
|
||||||
|
Write-IcingaConsoleError 'Your local stored host key is no longer valid. Using provided template key';
|
||||||
|
|
||||||
return 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) `
|
-DirectorUrl $DirectorUrl `
|
||||||
-OverrideDirectorVars $OverrideDirectorVars `
|
-SelfServiceAPIKey $TemplateKey `
|
||||||
-ForceTemplateKey;
|
-OverrideDirectorVars $OverrideDirectorVars `
|
||||||
|
-ForceTemplateKey;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
try {
|
||||||
|
$Arguments = Get-IcingaDirectorSelfServiceConfig -DirectorUrl $DirectorUrl -ApiKey $SelfServiceAPIKey;
|
||||||
|
} catch {
|
||||||
|
Write-IcingaConsoleError ([string]::Format('Failed to connect to your Icinga Director at "{0}". Please try again', $DirectorUrl));
|
||||||
|
|
||||||
|
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;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$Arguments = Convert-IcingaDirectorSelfServiceArguments -JsonInput $Arguments;
|
$Arguments = Convert-IcingaDirectorSelfServiceArguments -JsonInput $Arguments;
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue