mirror of
https://github.com/ansible-collections/community.general.git
synced 2026-02-04 07:51:50 +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:
parent
32dd5f04c5
commit
73452acf84
28 changed files with 243 additions and 280 deletions
|
|
@ -101,18 +101,15 @@ def info_strategy(api, wished_fn):
|
|||
fn_lookup = {fn["name"]: fn for fn in fn_list}
|
||||
|
||||
if wished_fn["name"] not in fn_lookup:
|
||||
msg = "Error during function lookup: Unable to find function named '%s' in namespace '%s'" % (wished_fn["name"],
|
||||
wished_fn["namespace_id"])
|
||||
msg = f"Error during function lookup: Unable to find function named '{wished_fn['name']}' in namespace '{wished_fn['namespace_id']}'"
|
||||
|
||||
api.module.fail_json(msg=msg)
|
||||
|
||||
target_fn = fn_lookup[wished_fn["name"]]
|
||||
|
||||
response = api.get(path=api.api_path + "/%s" % target_fn["id"])
|
||||
response = api.get(path=f"{api.api_path}/{target_fn['id']}")
|
||||
if not response.ok:
|
||||
msg = "Error during function lookup: %s: '%s' (%s)" % (response.info['msg'],
|
||||
response.json['message'],
|
||||
response.json)
|
||||
msg = f"Error during function lookup: {response.info['msg']}: '{response.json['message']}' ({response.json})"
|
||||
api.module.fail_json(msg=msg)
|
||||
|
||||
return response.json
|
||||
|
|
@ -126,7 +123,7 @@ def core(module):
|
|||
}
|
||||
|
||||
api = Scaleway(module=module)
|
||||
api.api_path = "functions/v1beta1/regions/%s/functions" % region
|
||||
api.api_path = f"functions/v1beta1/regions/{region}/functions"
|
||||
|
||||
summary = info_strategy(api=api, wished_fn=wished_function)
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue