From 17d884d87e39a90ad5ced0419980dccf8f327b2c Mon Sep 17 00:00:00 2001 From: Lord Hepipud Date: Fri, 11 Aug 2023 16:20:39 +0200 Subject: [PATCH] Fixes Update-Icinga not updating to latest or specified version --- doc/100-General/10-Changelog.md | 1 + lib/core/repository/Update-Icinga.psm1 | 6 +++--- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/doc/100-General/10-Changelog.md b/doc/100-General/10-Changelog.md index 2fc26e2..384beb2 100644 --- a/doc/100-General/10-Changelog.md +++ b/doc/100-General/10-Changelog.md @@ -14,6 +14,7 @@ Released closed milestones can be found on [GitHub](https://github.com/Icinga/ic ### Bugfixes * [#659](https://github.com/Icinga/icinga-powershell-framework/pull/659) Fixes configuration writer which publishes invalid Icinga plain configuration files +* [#660](https://github.com/Icinga/icinga-powershell-framework/pull/660) Fixes `Update-Icinga` not updating to the latest available version for a component and specifying `-Version` is updating to the latest one instead of the given one instead ## 1.11.0 (2023-08-01) diff --git a/lib/core/repository/Update-Icinga.psm1 b/lib/core/repository/Update-Icinga.psm1 index 4f3855c..66f3eb7 100644 --- a/lib/core/repository/Update-Icinga.psm1 +++ b/lib/core/repository/Update-Icinga.psm1 @@ -22,9 +22,9 @@ function Update-Icinga() continue; } - if ([string]::IsNullOrEmpty($Version) -eq $FALSE){ - $NewVersion = $Component.LatestVersion; - } else { + $NewVersion = $Component.LatestVersion; + + if ([string]::IsNullOrEmpty($Version) -eq $FALSE) { $NewVersion = $Version; }