1
0
Fork 0
mirror of https://github.com/ansible-collections/community.general.git synced 2024-09-14 20:13:21 +02:00

Minor fix to account for template service names in systemctl

This commit is contained in:
James Cammarata 2013-09-10 11:31:13 -05:00
parent 6c3af4df81
commit 7c8aa669cf

View file

@ -397,7 +397,7 @@ class LinuxService(Service):
# adjust the service name to account for template service unit files # adjust the service name to account for template service unit files
index = name.find('@') index = name.find('@')
if index != -1: if index != -1:
name = name[:index+1] self.name = name = name[:index+1]
look_for = "%s.service" % name look_for = "%s.service" % name
for line in out.splitlines(): for line in out.splitlines():
@ -419,6 +419,8 @@ class LinuxService(Service):
elif os.path.exists("/etc/init.d/%s" % self.name): elif os.path.exists("/etc/init.d/%s" % self.name):
# service is managed by with SysV init scripts, but with update-rc.d # service is managed by with SysV init scripts, but with update-rc.d
self.enable_cmd = location['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): elif location.get('rc-service', None) and not location.get('systemctl', None):
# service is managed by OpenRC # service is managed by OpenRC
self.svc_cmd = location['rc-service'] self.svc_cmd = location['rc-service']