supervisorctl: Don't try to start a starting program

Starting a "STARTING" program throws ERROR (already started),
so don't do that.
This commit is contained in:
Tomasz Kontusz 2014-12-02 22:33:49 +01:00
parent 2a794fa776
commit 18e641838a

View file

@ -210,10 +210,10 @@ def main():
module.fail_json(msg=out, name=name, state=state) module.fail_json(msg=out, name=name, state=state)
if state == 'started': if state == 'started':
take_action_on_processes(processes, lambda s: s != 'RUNNING', 'start', 'started') take_action_on_processes(processes, lambda s: s not in ('RUNNING', 'STARTING'), 'start', 'started')
if state == 'stopped': if state == 'stopped':
take_action_on_processes(processes, lambda s: s == 'RUNNING', 'stop', 'stopped') take_action_on_processes(processes, lambda s: s in ('RUNNING', 'STARTING'), 'stop', 'stopped')
# import module snippets # import module snippets
from ansible.module_utils.basic import * from ansible.module_utils.basic import *