From 5617d57c8cbbc3bb34087521ca3faee6f5cc92a0 Mon Sep 17 00:00:00 2001 From: Alexei Znamensky <103110+russoz@users.noreply.github.com> Date: Sun, 16 Nov 2025 11:07:56 +1300 Subject: [PATCH] xcc_redfish_command: fix messages showing dict keys (#11144) * xcc_redfish_command: fix messages showing dict keys * add changelog frag * Update plugins/modules/xcc_redfish_command.py Co-authored-by: Felix Fontein * Update plugins/modules/xcc_redfish_command.py Co-authored-by: Felix Fontein * Apply suggestions from code review * Update plugins/modules/xcc_redfish_command.py --------- Co-authored-by: Felix Fontein --- changelogs/fragments/11144-xcc-redfish-command-listkeys.yml | 2 ++ plugins/modules/xcc_redfish_command.py | 4 ++-- 2 files changed, 4 insertions(+), 2 deletions(-) create mode 100644 changelogs/fragments/11144-xcc-redfish-command-listkeys.yml diff --git a/changelogs/fragments/11144-xcc-redfish-command-listkeys.yml b/changelogs/fragments/11144-xcc-redfish-command-listkeys.yml new file mode 100644 index 0000000000..ebe51d6543 --- /dev/null +++ b/changelogs/fragments/11144-xcc-redfish-command-listkeys.yml @@ -0,0 +1,2 @@ +bugfixes: + - xcc_redfish_command - fix templating of dictionary keys as list (https://github.com/ansible-collections/community.general/pull/11144). diff --git a/plugins/modules/xcc_redfish_command.py b/plugins/modules/xcc_redfish_command.py index 97dde0e992..202512d3ca 100644 --- a/plugins/modules/xcc_redfish_command.py +++ b/plugins/modules/xcc_redfish_command.py @@ -556,7 +556,7 @@ class XCCRedfishUtils(RedfishUtils): data = response["data"] for key in request_body.keys(): if key not in data: - return {"ret": False, "msg": f"Key {key} not found. Supported key list: {data.keys()}"} + return {"ret": False, "msg": f"Key {key} not found. Supported key list: {list(data)}"} # perform patch response = self.patch_request(self.root_uri + resource_uri, request_body) @@ -735,7 +735,7 @@ def main(): # Check that Category is valid if category not in CATEGORY_COMMANDS_ALL: - module.fail_json(msg=f"Invalid Category '{category}'. Valid Categories = {CATEGORY_COMMANDS_ALL.keys()}") + module.fail_json(msg=f"Invalid Category '{category}'. Valid Categories = {list(CATEGORY_COMMANDS_ALL.keys())}") # Check that all commands are valid for cmd in command_list: