mirror of
https://github.com/ansible-collections/community.general.git
synced 2026-04-30 23:48:54 +00:00
modules [lm]*: use f-strings (#10971)
* modules [lm]*: use f-strings * add changelog frag
This commit is contained in:
parent
4a6a449fbd
commit
b527e80307
47 changed files with 453 additions and 454 deletions
|
|
@ -59,7 +59,7 @@ from ansible.module_utils.basic import AnsibleModule
|
|||
|
||||
def send_msg(module, token, msg, api, port):
|
||||
|
||||
message = "{0} {1}\n".format(token, msg)
|
||||
message = f"{token} {msg}\n"
|
||||
|
||||
api_ip = socket.gethostbyname(api)
|
||||
|
||||
|
|
@ -69,7 +69,7 @@ def send_msg(module, token, msg, api, port):
|
|||
if not module.check_mode:
|
||||
s.send(message)
|
||||
except Exception as e:
|
||||
module.fail_json(msg="failed to send message, msg=%s" % e)
|
||||
module.fail_json(msg=f"failed to send message, msg={e}")
|
||||
s.close()
|
||||
|
||||
|
||||
|
|
@ -93,7 +93,7 @@ def main():
|
|||
send_msg(module, token, msg, api, port)
|
||||
changed = True
|
||||
except Exception as e:
|
||||
module.fail_json(msg="unable to send msg: %s" % e)
|
||||
module.fail_json(msg=f"unable to send msg: {e}")
|
||||
|
||||
module.exit_json(changed=changed, msg=msg)
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue