mirror of
https://github.com/ansible-collections/community.general.git
synced 2026-04-09 13:37:15 +00:00
modules [no]*: use f-strings (#10973)
* modules [no]*: use f-strings * add changelog frag
This commit is contained in:
parent
50846b7560
commit
749c06cd01
44 changed files with 399 additions and 412 deletions
|
|
@ -177,17 +177,17 @@ def main():
|
|||
# timeout
|
||||
timeout = module.params['timeout']
|
||||
|
||||
base_uri = "https://" + module.params["baseuri"]
|
||||
base_uri = f"https://{module.params['baseuri']}"
|
||||
proxy_slot_number = module.params.get("proxy_slot_number")
|
||||
ocapi_utils = OcapiUtils(creds, base_uri, proxy_slot_number, timeout, module)
|
||||
|
||||
# Check that Category is valid
|
||||
if category not in CATEGORY_COMMANDS_ALL:
|
||||
module.fail_json(msg=to_native("Invalid Category '%s'. Valid Categories = %s" % (category, list(CATEGORY_COMMANDS_ALL.keys()))))
|
||||
module.fail_json(msg=to_native(f"Invalid Category '{category}'. Valid Categories = {list(CATEGORY_COMMANDS_ALL.keys())}"))
|
||||
|
||||
# Check that the command is valid
|
||||
if command not in CATEGORY_COMMANDS_ALL[category]:
|
||||
module.fail_json(msg=to_native("Invalid Command '%s'. Valid Commands = %s" % (command, CATEGORY_COMMANDS_ALL[category])))
|
||||
module.fail_json(msg=to_native(f"Invalid Command '{command}'. Valid Commands = {CATEGORY_COMMANDS_ALL[category]}"))
|
||||
|
||||
# Organize by Categories / Commands
|
||||
if category == "Jobs":
|
||||
|
|
@ -195,7 +195,7 @@ def main():
|
|||
if module.params.get("job_name") is None:
|
||||
module.fail_json(msg=to_native(
|
||||
"job_name required for JobStatus command."))
|
||||
job_uri = urljoin(base_uri, 'Jobs/' + module.params["job_name"])
|
||||
job_uri = urljoin(base_uri, f"Jobs/{module.params['job_name']}")
|
||||
result = ocapi_utils.get_job_status(job_uri)
|
||||
|
||||
if result['ret'] is False:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue