diff --git a/changelogs/fragments/12124-redfish-setmanagernic-keyerror.yml b/changelogs/fragments/12124-redfish-setmanagernic-keyerror.yml new file mode 100644 index 0000000000..2710cb1b84 --- /dev/null +++ b/changelogs/fragments/12124-redfish-setmanagernic-keyerror.yml @@ -0,0 +1,4 @@ +bugfixes: + - "redfish_config - fix ``KeyError: 'ret'`` when ``SetManagerNic`` cannot find a matching NIC + (https://github.com/ansible-collections/community.general/issues/5892, + https://github.com/ansible-collections/community.general/pull/12124)." diff --git a/plugins/module_utils/redfish_utils.py b/plugins/module_utils/redfish_utils.py index 32033e0df7..46b4923c07 100644 --- a/plugins/module_utils/redfish_utils.py +++ b/plugins/module_utils/redfish_utils.py @@ -3685,7 +3685,7 @@ class RedfishUtils: nic_info["ethernet_setting"] = target_ethernet_current_setting if target_ethernet_uri is None: - return {} + return {"ret": False, "msg": f"Manager NIC with address '{nic_addr}' not found"} else: return nic_info