Merge pull request #391 from cocoy/reload-feature
Feature: Add state=reloaded
This commit is contained in:
commit
8a687b77f8
1 changed files with 4 additions and 2 deletions
|
@ -120,7 +120,7 @@ list_items = params.get('list', None)
|
||||||
enable = params.get('enabled', params.get('enable', None))
|
enable = params.get('enabled', params.get('enable', None))
|
||||||
|
|
||||||
# running and started are the same
|
# running and started are the same
|
||||||
if state and state.lower() not in [ 'running', 'started', 'stopped', 'restarted' ]:
|
if state and state.lower() not in [ 'running', 'started', 'stopped', 'restarted','reloaded' ]:
|
||||||
fail_json(dict(failed=True, msg='invalid value for state'))
|
fail_json(dict(failed=True, msg='invalid value for state'))
|
||||||
if list_items and list_items.lower() not in [ 'status' ]:
|
if list_items and list_items.lower() not in [ 'status' ]:
|
||||||
fail_json(dict(failed=True, msg='invalid value for list'))
|
fail_json(dict(failed=True, msg='invalid value for list'))
|
||||||
|
@ -170,7 +170,7 @@ if state or enable:
|
||||||
|
|
||||||
if not running and state in ("started", "running"):
|
if not running and state in ("started", "running"):
|
||||||
changed = True
|
changed = True
|
||||||
elif running and state == "stopped":
|
elif running and state in ("stopped","reloaded"):
|
||||||
changed = True
|
changed = True
|
||||||
elif state == "restarted":
|
elif state == "restarted":
|
||||||
changed = True
|
changed = True
|
||||||
|
@ -183,6 +183,8 @@ if state or enable:
|
||||||
rc_state, stdout, stderr = _run("%s %s start" % (SERVICE, name))
|
rc_state, stdout, stderr = _run("%s %s start" % (SERVICE, name))
|
||||||
elif state == 'stopped':
|
elif state == 'stopped':
|
||||||
rc_state, stdout, stderr = _run("%s %s stop" % (SERVICE, name))
|
rc_state, stdout, stderr = _run("%s %s stop" % (SERVICE, name))
|
||||||
|
elif state == 'reloaded':
|
||||||
|
rc_state, stdout, stderr = _run("%s %s reload" % (SERVICE, name))
|
||||||
elif state == 'restarted':
|
elif state == 'restarted':
|
||||||
rc1, stdout1, stderr1 = _run("%s %s stop" % (SERVICE, name))
|
rc1, stdout1, stderr1 = _run("%s %s stop" % (SERVICE, name))
|
||||||
rc2, stdout2, stderr2 = _run("%s %s start" % (SERVICE, name))
|
rc2, stdout2, stderr2 = _run("%s %s start" % (SERVICE, name))
|
||||||
|
|
Loading…
Reference in a new issue