mirror of
https://github.com/ansible-collections/community.general.git
synced 2026-04-10 14:05:07 +00:00
Reformat everything.
This commit is contained in:
parent
3f2213791a
commit
340ff8586d
1008 changed files with 61301 additions and 58309 deletions
|
|
@ -81,37 +81,37 @@ from ansible.module_utils.basic import AnsibleModule
|
|||
|
||||
|
||||
def sysupgrade_run(module):
|
||||
sysupgrade_bin = module.get_bin_path('/usr/sbin/sysupgrade', required=True)
|
||||
sysupgrade_bin = module.get_bin_path("/usr/sbin/sysupgrade", required=True)
|
||||
cmd = [sysupgrade_bin]
|
||||
changed = False
|
||||
|
||||
# Setup command flags
|
||||
if module.params['snapshot']:
|
||||
run_flag = ['-s']
|
||||
if module.params['force']:
|
||||
if module.params["snapshot"]:
|
||||
run_flag = ["-s"]
|
||||
if module.params["force"]:
|
||||
# Force only applies to snapshots
|
||||
run_flag.append('-f')
|
||||
run_flag.append("-f")
|
||||
else:
|
||||
# release flag
|
||||
run_flag = ['-r']
|
||||
run_flag = ["-r"]
|
||||
|
||||
if module.params['keep_files']:
|
||||
run_flag.append('-k')
|
||||
if module.params["keep_files"]:
|
||||
run_flag.append("-k")
|
||||
|
||||
if module.params['fetch_only']:
|
||||
run_flag.append('-n')
|
||||
if module.params["fetch_only"]:
|
||||
run_flag.append("-n")
|
||||
|
||||
# installurl must be the last argument
|
||||
if module.params['installurl']:
|
||||
run_flag.append(module.params['installurl'])
|
||||
if module.params["installurl"]:
|
||||
run_flag.append(module.params["installurl"])
|
||||
|
||||
rc, out, err = module.run_command(cmd + run_flag)
|
||||
|
||||
if rc != 0:
|
||||
module.fail_json(msg=f"Command {cmd} failed rc={rc}, out={out}, err={err}")
|
||||
elif out.lower().find('already on latest snapshot') >= 0:
|
||||
elif out.lower().find("already on latest snapshot") >= 0:
|
||||
changed = False
|
||||
elif out.lower().find('upgrade on next reboot') >= 0:
|
||||
elif out.lower().find("upgrade on next reboot") >= 0:
|
||||
changed = True
|
||||
|
||||
return dict(
|
||||
|
|
@ -125,11 +125,11 @@ def sysupgrade_run(module):
|
|||
def main():
|
||||
module = AnsibleModule(
|
||||
argument_spec=dict(
|
||||
snapshot=dict(type='bool', default=False),
|
||||
fetch_only=dict(type='bool', default=True),
|
||||
force=dict(type='bool', default=False),
|
||||
keep_files=dict(type='bool', default=False),
|
||||
installurl=dict(type='str'),
|
||||
snapshot=dict(type="bool", default=False),
|
||||
fetch_only=dict(type="bool", default=True),
|
||||
force=dict(type="bool", default=False),
|
||||
keep_files=dict(type="bool", default=False),
|
||||
installurl=dict(type="str"),
|
||||
),
|
||||
supports_check_mode=False,
|
||||
)
|
||||
|
|
@ -137,5 +137,5 @@ def main():
|
|||
module.exit_json(**return_dict)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue