mirror of
https://github.com/Icinga/icinga-powershell-framework.git
synced 2025-12-20 23:00:35 -05:00
Fixes self service for removed hosts/keys
This commit is contained in:
parent
0228d302ed
commit
7f10d34ff0
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,6 +54,19 @@ function Start-IcingaAgentDirectorWizard()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ([string]::IsNullOrEmpty($LocalAPIKey) -eq $FALSE -And $LocalAPIKey -ne $TemplateKey -And $ForceTemplateKey -eq $FALSE) {
|
||||||
|
try {
|
||||||
|
$Arguments = Get-IcingaDirectorSelfServiceConfig -DirectorUrl $DirectorUrl -ApiKey $LocalAPIKey;
|
||||||
|
} catch {
|
||||||
|
Write-IcingaConsoleError 'Your local stored host key is no longer valid. Using provided template key';
|
||||||
|
|
||||||
|
return Start-IcingaAgentDirectorWizard `
|
||||||
|
-DirectorUrl $DirectorUrl `
|
||||||
|
-SelfServiceAPIKey $TemplateKey `
|
||||||
|
-OverrideDirectorVars $OverrideDirectorVars `
|
||||||
|
-ForceTemplateKey;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
try {
|
try {
|
||||||
$Arguments = Get-IcingaDirectorSelfServiceConfig -DirectorUrl $DirectorUrl -ApiKey $SelfServiceAPIKey;
|
$Arguments = Get-IcingaDirectorSelfServiceConfig -DirectorUrl $DirectorUrl -ApiKey $SelfServiceAPIKey;
|
||||||
} catch {
|
} catch {
|
||||||
|
|
@ -61,8 +74,8 @@ function Start-IcingaAgentDirectorWizard()
|
||||||
|
|
||||||
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) `
|
-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;
|
||||||
-ForceTemplateKey;
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$Arguments = Convert-IcingaDirectorSelfServiceArguments -JsonInput $Arguments;
|
$Arguments = Convert-IcingaDirectorSelfServiceArguments -JsonInput $Arguments;
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue