mirror of
https://github.com/ansible-collections/community.general.git
synced 2026-05-08 22:33:25 +00:00
whitespace + remove deprecated YAML parser (migration script lives in examples/scripts and warning was added
in 0.6 release)
This commit is contained in:
@@ -101,14 +101,14 @@ def _get_service_status(name):
|
||||
# iptables status command output is lame
|
||||
# TODO: lookup if we can use a return code for this instead?
|
||||
running = True
|
||||
|
||||
|
||||
return running
|
||||
|
||||
def _run(cmd):
|
||||
# returns (rc, stdout, stderr) from shell command
|
||||
process = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE, shell=True)
|
||||
stdout, stderr = process.communicate()
|
||||
return (process.returncode, stdout, stderr)
|
||||
return (process.returncode, stdout, stderr)
|
||||
|
||||
|
||||
def _do_enable(name, enable):
|
||||
@@ -126,9 +126,9 @@ def _do_enable(name, enable):
|
||||
rc, stdout, stderr = _run("%s %s %s" % (CHKCONFIG, name, valid_argument['on']))
|
||||
else:
|
||||
rc, stdout, stderr = _run("%s %s %s" % (CHKCONFIG, name, valid_argument['off']))
|
||||
|
||||
|
||||
return rc, stdout, stderr
|
||||
|
||||
|
||||
def main():
|
||||
module = AnsibleModule(
|
||||
argument_spec = dict(
|
||||
@@ -145,7 +145,7 @@ def main():
|
||||
# ===========================================
|
||||
# find binaries locations on minion
|
||||
_find_binaries(module)
|
||||
|
||||
|
||||
# ===========================================
|
||||
# get service status
|
||||
running = _get_service_status(name)
|
||||
@@ -156,7 +156,7 @@ def main():
|
||||
rc = 0
|
||||
err = ''
|
||||
out = ''
|
||||
|
||||
|
||||
if module.params['enabled']:
|
||||
rc_enable, out_enable, err_enable = _do_enable(name, enable)
|
||||
rc += rc_enable
|
||||
@@ -208,10 +208,10 @@ def main():
|
||||
result['state'] = state
|
||||
rc, stdout, stderr = _run("%s %s status" % (SERVICE, name))
|
||||
module.exit_json(**result);
|
||||
|
||||
|
||||
# this is magic, see lib/ansible/module_common.py
|
||||
#<<INCLUDE_ANSIBLE_MODULE_COMMON>>
|
||||
|
||||
# this is magic, see lib/ansible/module_common.py
|
||||
#<<INCLUDE_ANSIBLE_MODULE_COMMON>>
|
||||
|
||||
main()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user