From b4a091b419b9431ee68b064bc8e5d0618d4d4384 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 --- supervisorctl | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/supervisorctl b/supervisorctl index aec5a5e0530..541caf1fade 100755 --- a/supervisorctl +++ b/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':