mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02:00
Merge pull request #2005 from ftao/supervisorctl-update
always restart the program when state=restarted
This commit is contained in:
commit
7a49230e85
1 changed files with 2 additions and 5 deletions
|
@ -87,11 +87,11 @@ def main():
|
||||||
|
|
||||||
module.fail_json(msg=out)
|
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 update %s' % (SUPERVISORCTL, name))
|
||||||
rc, out, err = module.run_command('%s restart %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.exit_json(changed=True, name=name, state=state)
|
||||||
|
|
||||||
module.fail_json(msg=out)
|
module.fail_json(msg=out)
|
||||||
|
@ -104,9 +104,6 @@ def main():
|
||||||
|
|
||||||
module.fail_json(msg=out)
|
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)
|
module.exit_json(changed=False, name=name, state=state)
|
||||||
|
|
||||||
# this is magic, see lib/ansible/module_common.py
|
# this is magic, see lib/ansible/module_common.py
|
||||||
|
|
Loading…
Reference in a new issue