1
0
Fork 0
mirror of https://github.com/ansible-collections/community.general.git synced 2026-05-05 09:45:13 +00:00

modules i[^p]*: use f-strings (#10969)

* remove extraneous to_native()

* add changelog frag

* Apply suggestions from code review
This commit is contained in:
Alexei Znamensky 2025-10-26 00:41:49 +13:00 committed by GitHub
parent 0b6e99b28b
commit 50846b7560
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
21 changed files with 181 additions and 172 deletions

View file

@ -143,20 +143,20 @@ def main():
timeout = module.params['timeout']
# Build root URI
root_uri = "https://" + module.params['baseuri']
root_uri = f"https://{module.params['baseuri']}"
rf_utils = iLORedfishUtils(creds, root_uri, 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()))))
f"Invalid Category '{category}'. Valid Categories = {list(CATEGORY_COMMANDS_ALL.keys())}"))
# Check that all commands are valid
for cmd in command_list:
# Fail if even one command given is invalid
if cmd not in CATEGORY_COMMANDS_ALL[category]:
module.fail_json(
msg=to_native("Invalid Command '%s'. Valid Commands = %s" % (cmd, CATEGORY_COMMANDS_ALL[category])))
msg=to_native(f"Invalid Command '{cmd}'. Valid Commands = {CATEGORY_COMMANDS_ALL[category]}"))
if category == "Systems":
# execute only if we find a System resource