From abe8d8d4d64fc9f5dc919b3dee182cc6a711574e Mon Sep 17 00:00:00 2001 From: Stephen Fromm Date: Wed, 1 Aug 2012 14:58:32 -0700 Subject: [PATCH] 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. --- library/service | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/library/service b/library/service index c209c765807..188ef82709b 100755 --- a/library/service +++ b/library/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);