Skip to content

Commit 15b464f

Browse files
authored
Merge pull request #738 from Icinga:fix/print_error_for_update_command_in_case_component_is_not_installed
Fix: Update-Icinga to print an error in case a component is not installed Fixes `Update-Icinga` to print an error in case a component is not installed, instead of silently continue
2 parents 1fba01e + 9c69c35 commit 15b464f

File tree

2 files changed

+8
-0
lines changed

2 files changed

+8
-0
lines changed

doc/100-General/10-Changelog.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ Released closed milestones can be found on [GitHub](https://github.com/Icinga/ic
1313

1414
### Bugfixes
1515

16+
* [#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
1617
* [#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
1718

1819
### Enhancements

lib/core/repository/Update-Icinga.psm1

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ function Update-Icinga()
1616
$CurrentInstallation = Get-IcingaInstallation -Release:$Release -Snapshot:$Snapshot;
1717
[bool]$UpdateJEA = $FALSE;
1818
[array]$ComponentsList = @();
19+
[bool]$IsInstalled = $FALSE;
1920

2021
# We need to make sure that the framework is always installed first as component
2122
# to prevent possible race-conditions during update, in case we update plugins
@@ -44,6 +45,8 @@ function Update-Icinga()
4445
continue;
4546
}
4647

48+
$IsInstalled = $TRUE;
49+
4750
$NewVersion = $Component.LatestVersion;
4851

4952
if ([string]::IsNullOrEmpty($Version) -eq $FALSE) {
@@ -76,6 +79,10 @@ function Update-Icinga()
7679
Install-IcingaComponent -Name $entry -Version $NewVersion -Release:$Release -Snapshot:$Snapshot -Confirm:$Confirm -Force:$Force -KeepRepoErrors;
7780
}
7881

82+
if ($IsInstalled -eq $FALSE) {
83+
Write-IcingaConsoleError 'Failed to update the component "{0}", as it is not installed' -Objects $Name;
84+
}
85+
7986
# Update JEA profile if JEA is enabled once the update is complete
8087
if ([string]::IsNullOrEmpty((Get-IcingaJEAContext)) -eq $FALSE -And $UpdateJEA) {
8188
Update-IcingaJEAProfile;

0 commit comments

Comments
 (0)