parent
dc496ffeb4
commit
72eaf0281a
1 changed files with 14 additions and 15 deletions
|
@ -780,24 +780,23 @@ class LinuxService(Service):
|
||||||
action = 'enable'
|
action = 'enable'
|
||||||
klinks = glob.glob('/etc/rc?.d/K??' + self.name)
|
klinks = glob.glob('/etc/rc?.d/K??' + self.name)
|
||||||
if not klinks:
|
if not klinks:
|
||||||
(rc, out, err) = self.execute_command("%s %s defaults" % (self.enable_cmd, self.name))
|
if not self.module.check_mode:
|
||||||
if rc != 0:
|
(rc, out, err) = self.execute_command("%s %s defaults" % (self.enable_cmd, self.name))
|
||||||
if err:
|
if rc != 0:
|
||||||
self.module.fail_json(msg=err)
|
if err:
|
||||||
else:
|
self.module.fail_json(msg=err)
|
||||||
self.module.fail_json(msg=out) % (self.enable_cmd, self.name, action)
|
else:
|
||||||
|
self.module.fail_json(msg=out) % (self.enable_cmd, self.name, action)
|
||||||
else:
|
else:
|
||||||
action = 'disable'
|
action = 'disable'
|
||||||
|
|
||||||
if self.module.check_mode:
|
if not self.module.check_mode:
|
||||||
rc = 0
|
(rc, out, err) = self.execute_command("%s %s %s" % (self.enable_cmd, self.name, action))
|
||||||
return
|
if rc != 0:
|
||||||
(rc, out, err) = self.execute_command("%s %s %s" % (self.enable_cmd, self.name, action))
|
if err:
|
||||||
if rc != 0:
|
self.module.fail_json(msg=err)
|
||||||
if err:
|
else:
|
||||||
self.module.fail_json(msg=err)
|
self.module.fail_json(msg=out) % (self.enable_cmd, self.name, action)
|
||||||
else:
|
|
||||||
self.module.fail_json(msg=out) % (self.enable_cmd, self.name, action)
|
|
||||||
else:
|
else:
|
||||||
self.changed = False
|
self.changed = False
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue