summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJames Cammarata <jimi@sngx.net>2013-09-10 19:27:54 -0500
committerJames Cammarata <jimi@sngx.net>2013-09-10 19:37:51 -0500
commit9a3a3e648b33ee40445d0f8ca834f9b5b5c58435 (patch)
tree48e140401b53b46f579f8388076992273d0daafb
parent7c8aa669cf72a7263d0dea8d22e7b0591902531a (diff)
downloadansible-9a3a3e648b33ee40445d0f8ca834f9b5b5c58435.tar.gz
Check for systemd ownership of a service even if an init.d script exists
Also slight modification to the error message in the earlier commit that modified the update-rc.d detection portion of the code Fixes #3474
-rw-r--r--library/system/service10
1 files changed, 7 insertions, 3 deletions
diff --git a/library/system/service b/library/system/service
index 2d73c3524c..9cab0c12a9 100644
--- a/library/system/service
+++ b/library/system/service
@@ -407,8 +407,12 @@ class LinuxService(Service):
# Locate a tool for enable options
if location.get('chkconfig', None) and os.path.exists("/etc/init.d/%s" % self.name):
- # we are using a standard SysV service
- self.enable_cmd = location['chkconfig']
+ if check_systemd(self.name):
+ # service is managed by systemd
+ self.enable_cmd = location['systemctl']
+ else:
+ # we are using a standard SysV service
+ self.enable_cmd = location['chkconfig']
elif location.get('update-rc.d', None):
if check_systemd(self.name):
# service is managed by systemd
@@ -420,7 +424,7 @@ class LinuxService(Service):
# service is managed by with SysV init scripts, but with update-rc.d
self.enable_cmd = location['update-rc.d']
else:
- self.module.fail_json(msg="update-rc.d found but couldn't determine how the service is managed")
+ self.module.fail_json(msg="service not found: %s" % self.name)
elif location.get('rc-service', None) and not location.get('systemctl', None):
# service is managed by OpenRC
self.svc_cmd = location['rc-service']