Return extra information from service module
If _do_enable() is run and returns rc == 0, set changed=True Add enabled and state to result if they are supplied when the module is run.
This commit is contained in:
parent
64374ed7f2
commit
85f628ae26
1 changed files with 6 additions and 0 deletions
6
service
6
service
|
@ -158,6 +158,8 @@ def main():
|
|||
|
||||
if module.params['enabled']:
|
||||
rc_enable, out_enable, err_enable = _do_enable(name, enable)
|
||||
if rc == 0:
|
||||
changed = True
|
||||
rc += rc_enable
|
||||
out += out_enable
|
||||
err += err_enable
|
||||
|
@ -201,6 +203,10 @@ def main():
|
|||
module.fail_json(msg=err)
|
||||
|
||||
result = {"changed": changed}
|
||||
if module.params['enabled']:
|
||||
result['enabled'] = module.params['enabled']
|
||||
if state:
|
||||
result['state'] = state
|
||||
rc, stdout, stderr = _run("%s %s status" % (SERVICE, name))
|
||||
module.exit_json(**result);
|
||||
|
||||
|
|
Loading…
Reference in a new issue