From 63f24399b88341aa6022f076391009715ce87c0e Mon Sep 17 00:00:00 2001 From: Lord Hepipud Date: Tue, 4 Jan 2022 20:25:21 +0100 Subject: [PATCH] Fixes version splitting by returning major object --- doc/100-General/10-Changelog.md | 1 + lib/core/icingaagent/misc/Compare-IcingaVersions.psm1 | 2 +- lib/core/icingaagent/misc/Split-IcingaVersion.psm1 | 4 ++++ 3 files changed, 6 insertions(+), 1 deletion(-) diff --git a/doc/100-General/10-Changelog.md b/doc/100-General/10-Changelog.md index 8b1e391..7f59557 100644 --- a/doc/100-General/10-Changelog.md +++ b/doc/100-General/10-Changelog.md @@ -13,6 +13,7 @@ Released closed milestones can be found on [GitHub](https://github.com/Icinga/ic ### Bugfixes +* [#291](https://github.com/Icinga/icinga-powershell-framework/issues/291) Fixes `Split-IcingaVersion` by returning data with naming `mayor` for the version instead of `major`. We will return both results to give developers time to adjust their code before removing the `mayor` object * [#379](https://github.com/Icinga/icinga-powershell-framework/issues/379) Fixes memory leak for Icinga for Windows by using a custom function being more aggressive on memory cleanup * [#402](https://github.com/Icinga/icinga-powershell-framework/pull/402) Fixes missing address attribute for REST-Api daemon, making it unable to change the listening address * [#403](https://github.com/Icinga/icinga-powershell-framework/pull/403) Fixes memory leak on newly EventLog reader for CLI event stream diff --git a/lib/core/icingaagent/misc/Compare-IcingaVersions.psm1 b/lib/core/icingaagent/misc/Compare-IcingaVersions.psm1 index c2307e5..07f16a8 100644 --- a/lib/core/icingaagent/misc/Compare-IcingaVersions.psm1 +++ b/lib/core/icingaagent/misc/Compare-IcingaVersions.psm1 @@ -17,7 +17,7 @@ function Compare-IcingaVersions() $CurrentVersion = Get-IcingaAgentVersion; } - if ($requiredVersion.Mayor -gt $currentVersion.Mayor) { + if ($requiredVersion.Major -gt $currentVersion.Major) { return $FALSE; } diff --git a/lib/core/icingaagent/misc/Split-IcingaVersion.psm1 b/lib/core/icingaagent/misc/Split-IcingaVersion.psm1 index ffe21f6..ab8c371 100644 --- a/lib/core/icingaagent/misc/Split-IcingaVersion.psm1 +++ b/lib/core/icingaagent/misc/Split-IcingaVersion.psm1 @@ -4,10 +4,13 @@ function Split-IcingaVersion() [string]$Version ); + # TODO: Allow developers to adjust their code from mayor to major naming + # for the next releases and remove the mayor naming in the future if ([string]::IsNullOrEmpty($Version)) { return @{ 'Full' = ''; 'Mayor' = $null; + 'Major' = $null; 'Minor' = $null; 'Fixes' = $null; 'Snapshot' = $null; @@ -24,6 +27,7 @@ function Split-IcingaVersion() return @{ 'Full' = $Version; 'Mayor' = [int]$IcingaVersion[0]; + 'Major' = [int]$IcingaVersion[0]; 'Minor' = [int]$IcingaVersion[1]; 'Fixes' = [int]$IcingaVersion[2]; 'Snapshot' = $Snapshot;