|
|
@ -576,6 +576,7 @@ class LinuxService(Service):
|
|
|
|
action = 'enable'
|
|
|
|
action = 'enable'
|
|
|
|
else:
|
|
|
|
else:
|
|
|
|
action = 'disable'
|
|
|
|
action = 'disable'
|
|
|
|
|
|
|
|
|
|
|
|
(rc, out, err) = self.execute_command("%s -n %s %s" \
|
|
|
|
(rc, out, err) = self.execute_command("%s -n %s %s" \
|
|
|
|
% (self.enable_cmd, self.name, action))
|
|
|
|
% (self.enable_cmd, self.name, action))
|
|
|
|
self.changed = False
|
|
|
|
self.changed = False
|
|
|
@ -583,6 +584,12 @@ class LinuxService(Service):
|
|
|
|
if line.startswith('rename'):
|
|
|
|
if line.startswith('rename'):
|
|
|
|
self.changed = True
|
|
|
|
self.changed = True
|
|
|
|
break
|
|
|
|
break
|
|
|
|
|
|
|
|
elif self.enable and line.find('do not exist') != -1:
|
|
|
|
|
|
|
|
self.changed = True
|
|
|
|
|
|
|
|
break
|
|
|
|
|
|
|
|
elif not self.enable and line.find('already exist') != -1:
|
|
|
|
|
|
|
|
self.changed = True
|
|
|
|
|
|
|
|
break
|
|
|
|
|
|
|
|
|
|
|
|
if self.module.check_mode:
|
|
|
|
if self.module.check_mode:
|
|
|
|
self.module.exit_json(changed=self.changed)
|
|
|
|
self.module.exit_json(changed=self.changed)
|
|
|
@ -590,7 +597,17 @@ class LinuxService(Service):
|
|
|
|
if not self.changed:
|
|
|
|
if not self.changed:
|
|
|
|
return
|
|
|
|
return
|
|
|
|
|
|
|
|
|
|
|
|
return self.execute_command("%s %s %s" % (self.enable_cmd, self.name, action))
|
|
|
|
if self.enable:
|
|
|
|
|
|
|
|
# make sure the init.d symlinks are created
|
|
|
|
|
|
|
|
# otherwise enable might not work
|
|
|
|
|
|
|
|
(rc, out, err) = self.execute_command("%s %s defaults" \
|
|
|
|
|
|
|
|
% (self.enable_cmd, self.name))
|
|
|
|
|
|
|
|
if rc != 0:
|
|
|
|
|
|
|
|
return (rc, out, err)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return self.execute_command("%s %s enable" % (self.enable_cmd, self.name))
|
|
|
|
|
|
|
|
else:
|
|
|
|
|
|
|
|
return self.execute_command("%s -f %s remove" % (self.enable_cmd, self.name))
|
|
|
|
|
|
|
|
|
|
|
|
# we change argument depending on real binary used:
|
|
|
|
# we change argument depending on real binary used:
|
|
|
|
# - update-rc.d and systemctl wants enable/disable
|
|
|
|
# - update-rc.d and systemctl wants enable/disable
|
|
|
|