From 7817b69a1f7d5670bd7ba61fb4997b034a1359ef Mon Sep 17 00:00:00 2001 From: Lorenzo Luconi Trombacchi Date: Tue, 12 May 2015 11:07:52 +0200 Subject: [PATCH] status function was called twice --- lib/ansible/modules/extras/monitoring/monit.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/lib/ansible/modules/extras/monitoring/monit.py b/lib/ansible/modules/extras/monitoring/monit.py index 6afb95d093d..6410ce815e8 100644 --- a/lib/ansible/modules/extras/monitoring/monit.py +++ b/lib/ansible/modules/extras/monitoring/monit.py @@ -86,7 +86,8 @@ def main(): module.run_command('%s %s %s' % (MONIT, command, name), check_rc=True) return status() - present = status() != '' + process_status = status() + present = process_status != '' if not present and not state == 'present': module.fail_json(msg='%s process not presently configured with monit' % name, name=name, state=state) @@ -102,7 +103,7 @@ def main(): module.exit_json(changed=True, name=name, state=state) module.exit_json(changed=False, name=name, state=state) - running = 'running' in status() + running = 'running' in process_status if running and state in ['started', 'monitored']: module.exit_json(changed=False, name=name, state=state)