Properly parse the Icinga version for minimum version in the 'icinga' check

fixes #7415
This commit is contained in:
Michael Friedrich 2019-08-14 13:15:05 +02:00
parent da982c256b
commit 5b36ff0787
1 changed files with 1 additions and 5 deletions

View File

@ -172,11 +172,7 @@ void IcingaCheckTask::ScriptFunc(const Checkable::Ptr& checkable, const CheckRes
}
}
/* Extract the version number of the running Icinga2 instance.
* We assume that appVersion will allways be something like 'v2.10.1-8-gaebe6da' and we want to extract '2.10.1'.
*/
int endOfVersionNumber = appVersion.FindFirstOf("-") - 1;
String parsedAppVersion = appVersion.SubStr(1, endOfVersionNumber);
String parsedAppVersion = Utility::ParseVersion(appVersion);
/* Return an error if the version is less than specified (optional). */
if (missingIcingaMinVersion.IsEmpty() && !icingaMinVersion.IsEmpty() && Utility::CompareVersion(icingaMinVersion, parsedAppVersion) < 0) {