Skip to content

Commit

Permalink
Properly parse the Icinga version for minimum version in the 'icinga'…
Browse files Browse the repository at this point in the history
… check

fixes #7415
  • Loading branch information
Michael Friedrich committed Aug 14, 2019
1 parent da982c2 commit 5b36ff0
Showing 1 changed file with 1 addition and 5 deletions.
6 changes: 1 addition & 5 deletions lib/methods/icingachecktask.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down

0 comments on commit 5b36ff0

Please sign in to comment.