icinga-powershell-framework/lib/core/icingaagent/misc/Split-IcingaVersion.psm1

36 lines
965 B
PowerShell
Raw Normal View History

2019-09-29 12:25:40 -04:00
function Split-IcingaVersion()
{
param(
[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
2019-09-29 12:25:40 -04:00
if ([string]::IsNullOrEmpty($Version)) {
return @{
'Full' = '';
'Mayor' = $null;
'Major' = $null;
2019-09-29 12:25:40 -04:00
'Minor' = $null;
'Fixes' = $null;
'Snapshot' = $null;
}
}
[array]$IcingaVersion = $Version.Split('.');
$Snapshot = $null;
if ([string]::IsNullOrEmpty($IcingaVersion[3]) -eq $FALSE) {
$Snapshot = [int]$IcingaVersion[3];
}
return @{
'Full' = $Version;
'Mayor' = [int]$IcingaVersion[0];
'Major' = [int]$IcingaVersion[0];
2019-09-29 12:25:40 -04:00
'Minor' = [int]$IcingaVersion[1];
'Fixes' = [int]$IcingaVersion[2];
'Snapshot' = $Snapshot;
}
}