Skip to content

Commit

Permalink
fix monit version check
Browse files Browse the repository at this point in the history
it was erroneously checking > 3.18 instead of > 5.18

Fixes ansible#30614
  • Loading branch information
dannyroberts authored and abadger committed Oct 3, 2017
1 parent b26ae18 commit 3487892
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions lib/ansible/modules/monitoring/monit.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,11 +79,11 @@ def monit_version():
# Use only major and minor even if there are more these should be enough
return int(version[0]), int(version[1])

def is_version_higher_than_18():
return MONIT_MAJOR_VERSION > 3 or MONIT_MAJOR_VERSION == 3 and MONIT_MINOR_VERSION > 18
def is_version_higher_than_5_18():
return (MONIT_MAJOR_VERSION, MONIT_MINOR_VERSION) > (5, 18)

def parse(parts):
if is_version_higher_than_18():
if is_version_higher_than_5_18():
return parse_current(parts)
else:
return parse_older_versions(parts)
Expand Down Expand Up @@ -138,7 +138,7 @@ def wait_for_monit_to_stop_pending():

MONIT_MAJOR_VERSION, MONIT_MINOR_VERSION = monit_version()

SUMMARY_COMMAND = ('summary', 'summary -B')[is_version_higher_than_18()]
SUMMARY_COMMAND = ('summary', 'summary -B')[is_version_higher_than_5_18()]

if state == 'reloaded':
if module.check_mode:
Expand Down

0 comments on commit 3487892

Please sign in to comment.