mirror of
https://github.com/ansible-collections/community.general.git
synced 2026-05-07 13:52:54 +00:00
modules s[a-e]*: use f-strings (#10976)
* modules s[a-e]*: use f-strings * add changelog frag
This commit is contained in:
@@ -92,18 +92,15 @@ def info_strategy(api, wished_cn):
|
||||
cn_lookup = {cn["name"]: cn for cn in cn_list}
|
||||
|
||||
if wished_cn["name"] not in cn_lookup:
|
||||
msg = "Error during container registries lookup: Unable to find container registry named '%s' in project '%s'" % (wished_cn["name"],
|
||||
wished_cn["project_id"])
|
||||
msg = f"Error during container registries lookup: Unable to find container registry named '{wished_cn['name']}' in project '{wished_cn['project_id']}'"
|
||||
|
||||
api.module.fail_json(msg=msg)
|
||||
|
||||
target_cn = cn_lookup[wished_cn["name"]]
|
||||
|
||||
response = api.get(path=api.api_path + "/%s" % target_cn["id"])
|
||||
response = api.get(path=f"{api.api_path}/{target_cn['id']}")
|
||||
if not response.ok:
|
||||
msg = "Error during container registry lookup: %s: '%s' (%s)" % (response.info['msg'],
|
||||
response.json['message'],
|
||||
response.json)
|
||||
msg = f"Error during container registry lookup: {response.info['msg']}: '{response.json['message']}' ({response.json})"
|
||||
api.module.fail_json(msg=msg)
|
||||
|
||||
return response.json
|
||||
@@ -117,7 +114,7 @@ def core(module):
|
||||
}
|
||||
|
||||
api = Scaleway(module=module)
|
||||
api.api_path = "registry/v1/regions/%s/namespaces" % region
|
||||
api.api_path = f"registry/v1/regions/{region}/namespaces"
|
||||
|
||||
summary = info_strategy(api=api, wished_cn=wished_container_namespace)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user