1
0
Fork 0
mirror of https://github.com/ansible-collections/community.general.git synced 2026-04-12 15:05:07 +00:00

[PR #11106/f785e9c7 backport][stable-12] replace batch of redundant to_native()/to_text() occurrences (#11140)

replace batch of redundant to_native()/to_text() occurrences (#11106)

* replace batch of redundant to_native()/to_text() occurrences

* add changelog frag

* snap sanity

* rolling back snap for now

* more cases in redhat_subscription

(cherry picked from commit f785e9c780)

Co-authored-by: Alexei Znamensky <103110+russoz@users.noreply.github.com>
This commit is contained in:
patchback[bot] 2025-11-12 21:59:09 +01:00 committed by GitHub
parent 4b9ece4fbd
commit 619ea5b7b3
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
14 changed files with 47 additions and 45 deletions

View file

@ -178,21 +178,17 @@ def main():
# Check that Category is valid
if category not in CATEGORY_COMMANDS_ALL:
module.fail_json(
msg=to_native(f"Invalid Category '{category}'. Valid Categories = {list(CATEGORY_COMMANDS_ALL.keys())}")
)
module.fail_json(msg=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(f"Invalid Command '{command}'. Valid Commands = {CATEGORY_COMMANDS_ALL[category]}")
)
module.fail_json(msg=f"Invalid Command '{command}'. Valid Commands = {CATEGORY_COMMANDS_ALL[category]}")
# Organize by Categories / Commands
if category == "Jobs":
if command == "JobStatus":
if module.params.get("job_name") is None:
module.fail_json(msg=to_native("job_name required for JobStatus command."))
module.fail_json(msg="job_name required for JobStatus command.")
job_uri = urljoin(base_uri, f"Jobs/{module.params['job_name']}")
result = ocapi_utils.get_job_status(job_uri)