Minor fix to account for template service names in systemctl
This commit is contained in:
parent
6c3af4df81
commit
7c8aa669cf
1 changed files with 3 additions and 1 deletions
|
@ -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']
|
||||||
|
|
Loading…
Reference in a new issue