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

Merge pull request #5167 from jaspernbrouwer/devel

service_module: Fixed false positive on initctl as enable_cmd
This commit is contained in:
jctanner 2014-01-02 20:24:00 -08:00
commit 89abc35e59

View file

@ -431,10 +431,10 @@ class LinuxService(Service):
if check_systemd(self.name): if check_systemd(self.name):
# service is managed by systemd # service is managed by systemd
self.enable_cmd = location['systemctl'] self.enable_cmd = location['systemctl']
elif os.path.exists("/etc/init/%s.conf" % self.name): elif location['initctl'] and os.path.exists("/etc/init/%s.conf" % self.name):
# service is managed by upstart # service is managed by upstart
self.enable_cmd = location['initctl'] self.enable_cmd = location['initctl']
elif os.path.exists("/etc/init.d/%s" % self.name): elif location['update-rc.d'] and 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: else:
@ -649,7 +649,7 @@ class LinuxService(Service):
return return
if self.enable: if self.enable:
# make sure the init.d symlinks are created # make sure the init.d symlinks are created
# otherwise enable might not work # otherwise enable might not work
(rc, out, err) = self.execute_command("%s %s defaults" \ (rc, out, err) = self.execute_command("%s %s defaults" \
% (self.enable_cmd, self.name)) % (self.enable_cmd, self.name))