Fixes Update-Icinga to print an error in case a component is not installed

This commit is contained in:
Lord Hepipud 2024-06-06 14:39:45 +02:00
parent 1fba01e7a2
commit 9c69c351a8
2 changed files with 8 additions and 0 deletions

View file

@ -13,6 +13,7 @@ Released closed milestones can be found on [GitHub](https://github.com/Icinga/ic
### Bugfixes
* [#729](https://github.com/Icinga/icinga-powershell-framework/issues/729) Fixes `Update-Icinga` to print an error in case a component is not installed, instead of silently continue
* [#734](https://github.com/Icinga/icinga-powershell-framework/issues/734) Fixes a scenario on which a JEA service could become orphaned while manually stopping the Icinga for Windows service, without gracefully shutting down JEA
### Enhancements

View file

@ -16,6 +16,7 @@ function Update-Icinga()
$CurrentInstallation = Get-IcingaInstallation -Release:$Release -Snapshot:$Snapshot;
[bool]$UpdateJEA = $FALSE;
[array]$ComponentsList = @();
[bool]$IsInstalled = $FALSE;
# We need to make sure that the framework is always installed first as component
# to prevent possible race-conditions during update, in case we update plugins
@ -44,6 +45,8 @@ function Update-Icinga()
continue;
}
$IsInstalled = $TRUE;
$NewVersion = $Component.LatestVersion;
if ([string]::IsNullOrEmpty($Version) -eq $FALSE) {
@ -76,6 +79,10 @@ function Update-Icinga()
Install-IcingaComponent -Name $entry -Version $NewVersion -Release:$Release -Snapshot:$Snapshot -Confirm:$Confirm -Force:$Force -KeepRepoErrors;
}
if ($IsInstalled -eq $FALSE) {
Write-IcingaConsoleError 'Failed to update the component "{0}", as it is not installed' -Objects $Name;
}
# Update JEA profile if JEA is enabled once the update is complete
if ([string]::IsNullOrEmpty((Get-IcingaJEAContext)) -eq $FALSE -And $UpdateJEA) {
Update-IcingaJEAProfile;