now allows for case in which someone removed the K* links and is trying to reenable a service

pull/18777/head
Brian Coca 10 years ago committed by Matt Clay
parent 03273e06c7
commit b6a1927f13

@ -742,8 +742,8 @@ class LinuxService(Service):
if self.enable_cmd.endswith("update-rc.d"): if self.enable_cmd.endswith("update-rc.d"):
enabled = False enabled = False
links = glob.glob('/etc/rc?.d/S??' + self.name) slinks = glob.glob('/etc/rc?.d/S??' + self.name)
if links: if slinks:
enabled = True enabled = True
if self.enable != enabled: if self.enable != enabled:
@ -751,6 +751,14 @@ class LinuxService(Service):
if self.enable: if self.enable:
action = 'enable' action = 'enable'
klinks = glob.glob('/etc/rc?.d/K??' + self.name)
if not klinks:
(rc, out, err) = self.execute_command("%s %s defaults" % (self.enable_cmd, self.name))
if rc != 0:
if err:
self.module.fail_json(msg=err)
else:
self.module.fail_json(msg=out) % (self.enable_cmd, self.name, action)
else: else:
action = 'disable' action = 'disable'

Loading…
Cancel
Save