mirror of
https://github.com/Icinga/icinga2.git
synced 2025-07-27 07:34:15 +02:00
Merge pull request #6709 from ekeih/bugfix/icinga2-version-check-6703
Fix the Icinga2 version check for versions with more than 5 characters
This commit is contained in:
commit
680103f111
@ -174,9 +174,13 @@ void IcingaCheckTask::ScriptFunc(const Checkable::Ptr& checkable, const CheckRes
|
|||||||
cr->SetState(ServiceWarning);
|
cr->SetState(ServiceWarning);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Return an error if the version is less than specified (optional). */
|
/* Extract the version number of the running Icinga2 instance.
|
||||||
String parsedAppVersion = appVersion.SubStr(1,5);
|
* 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);
|
||||||
|
|
||||||
|
/* Return an error if the version is less than specified (optional). */
|
||||||
if (missingIcingaMinVersion.IsEmpty() && !icingaMinVersion.IsEmpty() && Utility::CompareVersion(icingaMinVersion, parsedAppVersion) < 0) {
|
if (missingIcingaMinVersion.IsEmpty() && !icingaMinVersion.IsEmpty() && Utility::CompareVersion(icingaMinVersion, parsedAppVersion) < 0) {
|
||||||
output += "; Minimum version " + icingaMinVersion + " is not installed.";
|
output += "; Minimum version " + icingaMinVersion + " is not installed.";
|
||||||
cr->SetState(ServiceCritical);
|
cr->SetState(ServiceCritical);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user