From 9174c52b1d04d8c09b07d45902171bc4cb47984d Mon Sep 17 00:00:00 2001 From: ftao Date: Thu, 7 Feb 2013 15:53:36 +0800 Subject: [PATCH] always restart the program when state=restarted --- library/supervisorctl | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/library/supervisorctl b/library/supervisorctl index 9e188cd454..0ba082dd8f 100644 --- a/library/supervisorctl +++ b/library/supervisorctl @@ -87,11 +87,11 @@ def main(): module.fail_json(msg=out) - elif running and state == 'restarted': + elif state == 'restarted': rc, out, err = module.run_command('%s update %s' % (SUPERVISORCTL, name)) rc, out, err = module.run_command('%s restart %s' % (SUPERVISORCTL, name)) - if '%s: stopped' % name in out and '%s: started' % name in out: + if '%s: started' % name in out: module.exit_json(changed=True, name=name, state=state) module.fail_json(msg=out) @@ -104,9 +104,6 @@ def main(): module.fail_json(msg=out) - elif not running and state == 'restarted': - module.fail_json(msg='Could not restart `%s` because it is not running' % name) - module.exit_json(changed=False, name=name, state=state) # this is magic, see lib/ansible/module_common.py