mirror of
https://github.com/ansible-collections/community.general.git
synced 2026-03-25 22:57:21 +00:00
Reformat everything.
This commit is contained in:
parent
3f2213791a
commit
340ff8586d
1008 changed files with 61301 additions and 58309 deletions
|
|
@ -69,9 +69,7 @@ from ansible.module_utils.basic import AnsibleModule
|
|||
|
||||
def run_module():
|
||||
# define available arguments/parameters a user can pass to the module
|
||||
module_args = dict(
|
||||
revert=dict(type='str', choices=['all', 'one'])
|
||||
)
|
||||
module_args = dict(revert=dict(type="str", choices=["all", "one"]))
|
||||
|
||||
module = AnsibleModule(
|
||||
argument_spec=module_args,
|
||||
|
|
@ -84,22 +82,22 @@ def run_module():
|
|||
|
||||
|
||||
def syspatch_run(module):
|
||||
cmd = module.get_bin_path('syspatch', True)
|
||||
cmd = module.get_bin_path("syspatch", True)
|
||||
changed = False
|
||||
reboot_needed = False
|
||||
|
||||
# Set safe defaults for run_flag and check_flag
|
||||
run_flag = ['-c']
|
||||
check_flag = ['-c']
|
||||
if module.params['revert']:
|
||||
check_flag = ['-l']
|
||||
run_flag = ["-c"]
|
||||
check_flag = ["-c"]
|
||||
if module.params["revert"]:
|
||||
check_flag = ["-l"]
|
||||
|
||||
if module.params['revert'] == 'all':
|
||||
run_flag = ['-R']
|
||||
if module.params["revert"] == "all":
|
||||
run_flag = ["-R"]
|
||||
else:
|
||||
run_flag = ['-r']
|
||||
run_flag = ["-r"]
|
||||
else:
|
||||
check_flag = ['-c']
|
||||
check_flag = ["-c"]
|
||||
run_flag = []
|
||||
|
||||
# Run check command
|
||||
|
|
@ -122,17 +120,17 @@ def syspatch_run(module):
|
|||
|
||||
# Workaround syspatch ln bug:
|
||||
# http://openbsd-archive.7691.n7.nabble.com/Warning-applying-latest-syspatch-td354250.html
|
||||
if rc != 0 and err != 'ln: /usr/X11R6/bin/X: No such file or directory\n':
|
||||
if rc != 0 and err != "ln: /usr/X11R6/bin/X: No such file or directory\n":
|
||||
module.fail_json(msg=f"Command {cmd} failed rc={rc}, out={out}, err={err}")
|
||||
elif out.lower().find('create unique kernel') >= 0:
|
||||
elif out.lower().find("create unique kernel") >= 0:
|
||||
# Kernel update applied
|
||||
reboot_needed = True
|
||||
elif out.lower().find('syspatch updated itself') >= 0:
|
||||
module.warn('Syspatch was updated. Please run syspatch again.')
|
||||
elif out.lower().find("syspatch updated itself") >= 0:
|
||||
module.warn("Syspatch was updated. Please run syspatch again.")
|
||||
|
||||
# If no stdout, then warn user
|
||||
if len(out) == 0:
|
||||
module.warn('syspatch had suggested changes, but stdout was empty.')
|
||||
module.warn("syspatch had suggested changes, but stdout was empty.")
|
||||
|
||||
changed = True
|
||||
else:
|
||||
|
|
@ -151,5 +149,5 @@ def main():
|
|||
run_module()
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue