[stable-2.6] Fix 2 issues in sysvinit module (backport/2.6/42786) (#43831)

* Fix 2 issues in sysvinit module (#42786)

* Do not compare result to unset parameter in sysvinit module

* Fix misformed command in sysvinit module

* Small None-comparison style fix in sysvinit module

(cherry picked from commit f26272a492)

* Update changelog
pull/43832/head
Pilou 6 years ago committed by Matt Clay
parent 6f529a20b3
commit 516ed4d7bc

@ -0,0 +1,4 @@
bugfixes:
- "sysvinit module: handle values of optional parameters (https://github.com/ansible/ansible/pull/42786).
Don't disable service when `enabled` parameter isn't set.
Fix command when `arguments` parameter isn't set."

@ -259,7 +259,7 @@ def main():
elif location.get('chkconfig'):
(rc, out, err) = module.run_command("%s --level %s %s off" % (location['chkconfig'], ''.join(runlevels), name))
else:
if enabled != runlevel_status["enabled"]:
if enabled is not None and enabled != runlevel_status["enabled"]:
result['changed'] = True
result['status']['enabled']['changed'] = True
@ -300,7 +300,9 @@ def main():
def runme(doit):
cmd = "%s %s %s %s" % (script, doit, name, module.params['arguments'])
args = module.params['arguments']
cmd = "%s %s %s" % (script, doit, "" if args is None else args)
# how to run
if module.params['daemonize']:
(rc, out, err) = daemonize(cmd)

Loading…
Cancel
Save