From a82928e7dcc246be02ac838d091e22395fa2efff Mon Sep 17 00:00:00 2001 From: Matt Wright Date: Tue, 28 Aug 2012 19:21:05 -0400 Subject: [PATCH] fix bug in supervisorctl module --- library/supervisorctl | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/library/supervisorctl b/library/supervisorctl index aec5a5e053..541caf1fad 100755 --- a/library/supervisorctl +++ b/library/supervisorctl @@ -19,8 +19,6 @@ # along with Ansible. If not, see . # -SUPERVISORCTL = None - def _find_supervisorctl(): paths = ['/usr/local/bin', '/usr/bin'] @@ -29,11 +27,9 @@ def _find_supervisorctl(): if os.path.exists(e): return e - module.fail_json(msg='supervisorctl is not installed') - def _is_running(name): - rc, out, err = _run('%s status %s' % (SUPERVISORCTL, name)) + rc, out, err = _run('%s status %s' % (_find_supervisorctl(), name)) return 'RUNNING' in out @@ -58,6 +54,9 @@ def main(): SUPERVISORCTL = _find_supervisorctl() + if SUPERVISORCTL is None: + module.fail_json(msg='supervisorctl is not installed') + running = _is_running(name) if running and state == 'started':