From a092eadbbb163d3169afbb2690c2e3441686e3a6 Mon Sep 17 00:00:00 2001 From: Matt Wright Date: Fri, 31 Aug 2012 11:03:14 -0400 Subject: [PATCH 1/2] Fix supervisorctl module after merge issue --- library/supervisorctl | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/library/supervisorctl b/library/supervisorctl index 2f33c37ecd..7cf55fb1fd 100755 --- a/library/supervisorctl +++ b/library/supervisorctl @@ -19,10 +19,20 @@ # along with Ansible. If not, see . # +def _find_supervisorctl(): + paths = ['/usr/local/bin', '/usr/bin'] + + for p in paths: + e = p + '/supervisorctl' + if os.path.exists(e): + return e + + def _is_present(name): rc, out, err = _run('%s status' % _find_supervisorctl()) return name in out + def _is_running(name, supervisorctl): rc, out, err = _run('%s status %s' % (supervisorctl, name)) return 'RUNNING' in out From d52f1d969b1c45d090af5f780af1b106cbf4b7e9 Mon Sep 17 00:00:00 2001 From: Matt Wright Date: Fri, 31 Aug 2012 15:03:26 -0400 Subject: [PATCH 2/2] Use `get_bin_path` properly --- library/supervisorctl | 18 +++--------------- 1 file changed, 3 insertions(+), 15 deletions(-) diff --git a/library/supervisorctl b/library/supervisorctl index 7cf55fb1fd..880388abd5 100755 --- a/library/supervisorctl +++ b/library/supervisorctl @@ -19,17 +19,8 @@ # along with Ansible. If not, see . # -def _find_supervisorctl(): - paths = ['/usr/local/bin', '/usr/bin'] - - for p in paths: - e = p + '/supervisorctl' - if os.path.exists(e): - return e - - -def _is_present(name): - rc, out, err = _run('%s status' % _find_supervisorctl()) +def _is_present(name, supervisorctl): + rc, out, err = _run('%s status' % supervisorctl) return name in out @@ -59,10 +50,7 @@ def main(): SUPERVISORCTL = module.get_bin_path('supervisorctl', True) - if SUPERVISORCTL is None: - module.fail_json(msg='supervisorctl is not installed') - - present = _is_present(name) + present = _is_present(name, SUPERVISORCTL) if state == 'present': if not present: