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
22 changed files with 153 additions and 155 deletions

View File

@@ -93,16 +93,15 @@ def main():
try:
value = redis.connection.get(key)
except Exception as e:
msg = 'Failed to get value of key "{0}" with exception: {1}'.format(
key, str(e))
msg = f'Failed to get value of key "{key}" with exception: {e}'
result['msg'] = msg
module.fail_json(**result)
if value is None:
msg = 'Key "{0}" does not exist in database'.format(key)
msg = f'Key "{key}" does not exist in database'
result['exists'] = False
else:
msg = 'Got key "{0}"'.format(key)
msg = f'Got key "{key}"'
result['value'] = value
result['exists'] = True
result['msg'] = msg