icinga-powershell-framework/lib/core/icingaagent/misc/Compare-IcingaVersions.psm1

34 lines
808 B
PowerShell
Raw Normal View History

2019-09-29 12:25:40 -04:00
function Compare-IcingaVersions()
{
param(
$CurrentVersion,
$RequiredVersion
);
if ([string]::IsNullOrEmpty($RequiredVersion)) {
return $FALSE;
}
2019-09-29 12:25:40 -04:00
$RequiredVersion = Split-IcingaVersion -Version $RequiredVersion;
2019-09-29 12:25:40 -04:00
if ([string]::IsNullOrEmpty($CurrentVersion) -eq $FALSE) {
$CurrentVersion = Split-IcingaVersion -Version $CurrentVersion;
} else {
$CurrentVersion = Get-IcingaAgentVersion;
}
if ($requiredVersion.Major -gt $currentVersion.Major) {
2019-09-29 12:25:40 -04:00
return $FALSE;
}
if ($requiredVersion.Minor -gt $currentVersion.Minor) {
return $FALSE;
}
if ($requiredVersion.Minor -ge $currentVersion.Minor -And $requiredVersion.Fixes -gt $currentVersion.Fixes) {
return $FALSE;
}
return $TRUE;
}