diff --git a/changelogs/fragments/2040-fix-index-error-in-redfish-set-manager-nic.yml b/changelogs/fragments/2040-fix-index-error-in-redfish-set-manager-nic.yml new file mode 100644 index 0000000000..04d9a11101 --- /dev/null +++ b/changelogs/fragments/2040-fix-index-error-in-redfish-set-manager-nic.yml @@ -0,0 +1,2 @@ +bugfixes: + - redfish_config module, redfish_utils module utils - fix IndexError in ``SetManagerNic`` command (https://github.com/ansible-collections/community.general/issues/1692). diff --git a/plugins/module_utils/redfish_utils.py b/plugins/module_utils/redfish_utils.py index 0fd421a3e2..67a17bd8d1 100644 --- a/plugins/module_utils/redfish_utils.py +++ b/plugins/module_utils/redfish_utils.py @@ -2672,6 +2672,10 @@ class RedfishUtils(object): need_change = True # type is list if isinstance(set_value, list): + if len(set_value) != len(cur_value): + # if arrays are not the same len, no need to check each element + need_change = True + continue for i in range(len(set_value)): for subprop in payload[property][i].keys(): if subprop not in target_ethernet_current_setting[property][i]: