summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJames Cammarata <jimi@sngx.net>2013-09-10 11:31:13 -0500
committerJames Cammarata <jimi@sngx.net>2013-09-10 11:31:13 -0500
commit7c8aa669cf72a7263d0dea8d22e7b0591902531a (patch)
tree4fbb8ac5b4f5dd1a595e541d3ced5cbc286dbc12
parent6c3af4df81772852bd1805941195fa7bc28d1f1a (diff)
downloadansible-7c8aa669cf72a7263d0dea8d22e7b0591902531a.tar.gz
Minor fix to account for template service names in systemctl
-rw-r--r--library/system/service4
1 files changed, 3 insertions, 1 deletions
diff --git a/library/system/service b/library/system/service
index e711bbc302..2d73c3524c 100644
--- a/library/system/service
+++ b/library/system/service
@@ -397,7 +397,7 @@ class LinuxService(Service):
# adjust the service name to account for template service unit files
index = name.find('@')
if index != -1:
- name = name[:index+1]
+ self.name = name = name[:index+1]
look_for = "%s.service" % name
for line in out.splitlines():
@@ -419,6 +419,8 @@ class LinuxService(Service):
elif os.path.exists("/etc/init.d/%s" % self.name):
# 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")
elif location.get('rc-service', None) and not location.get('systemctl', None):
# service is managed by OpenRC
self.svc_cmd = location['rc-service']