1
0
Fork 0
mirror of https://github.com/ansible-collections/community.general.git synced 2026-05-03 17:03:06 +00:00

modules r*: use f-strings (#10975)

* modules r*: use f-strings

* add changelog frag

* Apply suggestions from code review
This commit is contained in:
Alexei Znamensky 2025-10-26 19:48:33 +13:00 committed by GitHub
parent 749c06cd01
commit d51e4c188b
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
22 changed files with 153 additions and 155 deletions

View file

@ -174,7 +174,7 @@ def build_payload_for_rocketchat(module, text, channel, username, icon_url, icon
if channel[0] == '#' or channel[0] == '@':
payload['channel'] = channel
else:
payload['channel'] = '#' + channel
payload['channel'] = f"#{channel}"
if username is not None:
payload['username'] = username
if icon_emoji is not None:
@ -196,7 +196,7 @@ def build_payload_for_rocketchat(module, text, channel, username, icon_url, icon
payload = module.jsonify(payload)
if is_pre740:
payload = "payload=" + payload
payload = f"payload={payload}"
return payload
@ -212,7 +212,7 @@ def do_notify_rocketchat(module, domain, token, protocol, payload, is_pre740):
headers = {'Content-type': 'application/json'}
response, info = fetch_url(module, rocketchat_incoming_webhook, data=payload, headers=headers)
if info['status'] != 200:
module.fail_json(msg="failed to send message, return status=%s" % str(info['status']))
module.fail_json(msg=f"failed to send message, return status={info['status']}")
def main():