From 5b36ff07878488ee9d4e8c24f1ac944746e96848 Mon Sep 17 00:00:00 2001 From: Michael Friedrich Date: Wed, 14 Aug 2019 13:15:05 +0200 Subject: [PATCH] Properly parse the Icinga version for minimum version in the 'icinga' check fixes #7415 --- lib/methods/icingachecktask.cpp | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/lib/methods/icingachecktask.cpp b/lib/methods/icingachecktask.cpp index e67d1ff94..c2013707f 100644 --- a/lib/methods/icingachecktask.cpp +++ b/lib/methods/icingachecktask.cpp @@ -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) { -- 2.40.0