From c50859d20b63061bdc85254079546a0f42024c0c Mon Sep 17 00:00:00 2001 From: Brian Coca Date: Wed, 1 Jun 2016 12:34:26 -0400 Subject: [PATCH] fixed enabled state --- system/systemd.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/system/systemd.py b/system/systemd.py index 03b7853f784..4c57aa33f67 100644 --- a/system/systemd.py +++ b/system/systemd.py @@ -309,6 +309,9 @@ def main(): if rc == 0 or (os.access(initscript, os.X_OK) and bool(glob.glob('/etc/rc?.d/S??' + unit))): enabled = True + # default to current state + result['enabled'] = enabled + # Change enable/disable if needed if enabled != module.params['enabled']: result['changed'] = True @@ -322,7 +325,7 @@ def main(): if rc != 0: module.fail_json(msg="Unable to %s service %s: %s" % (action, unit, err)) - result['enabled'] = enabled + result['enabled'] = not enabled if module.params['state'] is not None: