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: