Thanks to visit codestin.com
Credit goes to github.com

Skip to content

fix monit version check#31212

Merged
abadger merged 1 commit into
ansible:develfrom
dannyroberts:fix-monit-version-check
Oct 3, 2017
Merged

fix monit version check#31212
abadger merged 1 commit into
ansible:develfrom
dannyroberts:fix-monit-version-check

Conversation

@dannyroberts

Copy link
Copy Markdown
Contributor
SUMMARY

Fixes #30614. There is logic to distinguish monit versions that do and don't support/require the use of -B to get colorless output; this logic was erroneously checking > 3.18 instead of > 5.18.

Current version as the time of this writing is 5.24.0 (https://mmonit.com/monit/) and color support (and consequently support for/requirement of -B for colorless output) was introduced in 5.18.0 (https://mmonit.com/monit/changes/). However, currently the major version is being compared with 3 rather than 5. I believe this to be a simple typo.

In addition to change 3 to 5, I also changed the expression behind it to be more obvious and the function name to be more explicit.

ISSUE TYPE
  • Bugfix Pull Request
COMPONENT NAME

lib/ansible/modules/monitoring/monit.py

ANSIBLE VERSION
ansible 2.4.0.0
  config file = /home/droberts/commcarehq-ansible/ansible/ansible.cfg
  configured module search path = [u'/home/droberts/.ansible/plugins/modules', u'/usr/share/ansible/plugins/modules']
  ansible python module location = /home/droberts/.virtualenvs/ansible/local/lib/python2.7/site-packages/ansible
  executable location = /home/droberts/.virtualenvs/ansible/bin/ansible
  python version = 2.7.6 (default, Jun 22 2015, 17:58:13) [GCC 4.8.2]
ADDITIONAL INFORMATION

Before

TASK [couchdb2 : monit] ************************************************************************************************************************************************************************************
fatal: [xx.xx.xx.xx]: FAILED! => {"changed": false, "cmd": "/usr/bin/monit summary -B", "failed": true, "msg": "monit: invalid option -- B  (-h will show valid options)", "rc": 1, "stderr": "monit: invalid option -- B  (-h will show valid options)\n", "stderr_lines": ["monit: invalid option -- B  (-h will show valid options)"], "stdout": "", "stdout_lines": []}
	to retry, use: --limit @/home/droberts/commcarehq-ansible/ansible/deploy_stack.retry

After

TASK [couchdb2 : monit] ************************************************************************************************************************************************************************************
ok: [xx.xx.xx.xx]

it was erroneously checking > 3.18 instead of > 5.18

Fixes ansible#30614
@ansibot

ansibot commented Oct 2, 2017

Copy link
Copy Markdown
Contributor

@ansibot ansibot added affects_2.5 This issue/PR affects Ansible v2.5 bugfix_pull_request module This issue/PR relates to a module. needs_triage Needs a first human triage before being processed. labels Oct 2, 2017
@dannyroberts

Copy link
Copy Markdown
Contributor Author

Also affects 2.4; does not affect 2.3 or below.

@bcoca bcoca removed the needs_triage Needs a first human triage before being processed. label Oct 2, 2017
@samdoran samdoran added the affects_2.4 This issue/PR affects Ansible v2.4 label Oct 2, 2017
@mangas

mangas commented Oct 3, 2017

Copy link
Copy Markdown
Contributor

I don't have a way to test that at the moment but that makes sense to me. Although there might be some confusion on the OS package versions vs the actual software version so if it works for you it could've been my mistake !

@mangas

mangas commented Oct 3, 2017

Copy link
Copy Markdown
Contributor

https://bitbucket.org/tildeslash/monit/src/4eaf7cd8d68595db02045c2871200a65e6615b00/CHANGES?at=release-5-18-0&fileviewer=file-view-default

Looking at monit it seems like 5.18 is the correct version so it looks alright to me although I am not a maintainer so I don't know if I can shipit!

@dannyroberts

Copy link
Copy Markdown
Contributor Author

@mangas, thanks for the review. My certainty comes both from testing it and seeing it fixed my problem (which of course is only half the story) but also (and mostly) from the changes documentation for monit 5.18 (https://mmonit.com/monit/changes/#5.18.0) which puts the introduction of colors and -B at that release.

For some context, what makes this bug a stopper for me (and I assume others) is that apt-get's main repository (on Ubuntu 14.04 at least) doesn't let you install anything above monit 5.6:

# apt-cache policy monit
monit:
  Installed: 1:5.6-2
  Candidate: 1:5.6-2
  Version table:
 *** 1:5.6-2 0
        500 http://mirrors.service.networklayer.com/ubuntu/ trusty/universe amd64 Packages
        100 /var/lib/dpkg/status

meaning that there's no easily available path to working around this bug by upgrading monit.

@mangas

mangas commented Oct 3, 2017

Copy link
Copy Markdown
Contributor

maybe @calfonso could help!

@dannyroberts

Copy link
Copy Markdown
Contributor Author

Just saw your last message. Thanks, @mangas !

@brian-brazil @dstoflet Just confirmed with the author of the original PR (#21891) that this bugfix is correct. Mind taking a look?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

affects_2.4 This issue/PR affects Ansible v2.4 affects_2.5 This issue/PR affects Ansible v2.5 bug This issue/PR relates to a bug. module This issue/PR relates to a module.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

monit.py results in ..."cmd": "/bin/monit summary -B", "failed"...

6 participants