Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix monit version check #31212

Merged
merged 1 commit into from
Oct 3, 2017
Merged

Conversation

dannyroberts
Copy link
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
Copy link
Contributor

ansibot commented Oct 2, 2017

@ansibot ansibot added affects_2.5 This issue/PR affects Ansible v2.5 bugfix_pull_request community_review In order to be merged, this PR must follow the community review workflow. module This issue/PR relates to a module. needs_triage Needs a first human triage before being processed. support:community This issue/PR relates to code supported by the Ansible community. labels Oct 2, 2017
@dannyroberts
Copy link
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
@bcoca bcoca added this to Nominated in 2.4.x Blocker List Oct 2, 2017
@samdoran samdoran added the affects_2.4 This issue/PR affects Ansible v2.4 label Oct 2, 2017
@mangas
Copy link
Contributor

mangas commented Oct 3, 2017

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
Copy link
Contributor

mangas commented Oct 3, 2017

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
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
Copy link
Contributor

mangas commented Oct 3, 2017

maybe @calfonso could help!

@dannyroberts
Copy link
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?

@ansibot ansibot added the bug This issue/PR relates to a bug. label Mar 6, 2018
@ansible ansible locked and limited conversation to collaborators Apr 26, 2019
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. community_review In order to be merged, this PR must follow the community review workflow. module This issue/PR relates to a module. support:community This issue/PR relates to code supported by the Ansible community.
Projects
No open projects
2.4.x Blocker List
Done in 2.4.1
Development

Successfully merging this pull request may close these issues.

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