1
0
Fork 0
mirror of https://github.com/ansible-collections/community.general.git synced 2026-04-26 13:42:49 +00:00

modules a*: use f-strings (#10942)

* modules a*: use f-strings

* add changelog frag

* add changelog frag

* rename chglof frag file
This commit is contained in:
Alexei Znamensky 2025-10-23 17:50:32 +13:00 committed by GitHub
parent 0feabaa7da
commit d86340b9d3
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
22 changed files with 219 additions and 214 deletions

View file

@ -182,8 +182,7 @@ def main():
if module.params['state'] == 'present':
# create new entry string
new_entry = module.params['name'] + ":" + module.params['runlevel'] + \
":" + module.params['action'] + ":" + module.params['command']
new_entry = f"{module.params['name']}:{module.params['runlevel']}:{module.params['action']}:{module.params['command']}"
# If current entry exists or fields are different(if the entry does not
# exists, then the entry will be created
@ -199,7 +198,7 @@ def main():
if rc != 0:
module.fail_json(
msg="could not change inittab", rc=rc, err=err)
result['msg'] = "changed inittab entry" + " " + current_entry['name']
result['msg'] = f"changed inittab entry {current_entry['name']}"
result['changed'] = True
# If the entry does not exist create the entry
@ -215,7 +214,7 @@ def main():
if rc != 0:
module.fail_json(msg="could not adjust inittab", rc=rc, err=err)
result['msg'] = "add inittab entry" + " " + module.params['name']
result['msg'] = f"add inittab entry {module.params['name']}"
result['changed'] = True
elif module.params['state'] == 'absent':
@ -227,7 +226,7 @@ def main():
if rc != 0:
module.fail_json(
msg="could not remove entry from inittab)", rc=rc, err=err)
result['msg'] = "removed inittab entry" + " " + current_entry['name']
result['msg'] = f"removed inittab entry {current_entry['name']}"
result['changed'] = True
module.exit_json(**result)