mirror of https://github.com/Icinga/icinga2.git
Ensure that icinga_min_version parameter is optional
Seen that here: https://github.com/Icinga/icinga2/issues/6319#issuecomment-390195058 refs #5960 refs #3998
This commit is contained in:
parent
79b23fce3c
commit
4a68ed9a5f
|
@ -55,8 +55,10 @@ void IcingaCheckTask::ScriptFunc(const Checkable::Ptr& checkable, const CheckRes
|
|||
resolvers.emplace_back("command", commandObj);
|
||||
resolvers.emplace_back("icinga", IcingaApplication::GetInstance());
|
||||
|
||||
String missingIcingaMinVersion;
|
||||
|
||||
String icingaMinVersion = MacroProcessor::ResolveMacros("$icinga_min_version$", resolvers, checkable->GetLastCheckResult(),
|
||||
nullptr, MacroProcessor::EscapeCallback(), resolvedMacros, useResolvedMacros);
|
||||
&missingIcingaMinVersion, MacroProcessor::EscapeCallback(), resolvedMacros, useResolvedMacros);
|
||||
|
||||
if (resolvedMacros && !useResolvedMacros)
|
||||
return;
|
||||
|
@ -175,7 +177,7 @@ void IcingaCheckTask::ScriptFunc(const Checkable::Ptr& checkable, const CheckRes
|
|||
/* Return an error if the version is less than specified (optional). */
|
||||
String parsedAppVersion = appVersion.SubStr(1,5);
|
||||
|
||||
if (!icingaMinVersion.IsEmpty() && Utility::CompareVersion(icingaMinVersion, parsedAppVersion) < 0) {
|
||||
if (missingIcingaMinVersion.IsEmpty() && !icingaMinVersion.IsEmpty() && Utility::CompareVersion(icingaMinVersion, parsedAppVersion) < 0) {
|
||||
output += "; Minimum version " + icingaMinVersion + " is not installed.";
|
||||
cr->SetState(ServiceCritical);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue