From 0b2ebabd29a7ac1e6a4278318f4c8a0cc436132a Mon Sep 17 00:00:00 2001 From: Bill Dodd Date: Fri, 19 Mar 2021 13:06:57 -0500 Subject: [PATCH] Fix IndexError in SetManagerNic (#2040) * fix IndexError in SetManagerNic * add changelog fragment --- .../2040-fix-index-error-in-redfish-set-manager-nic.yml | 2 ++ plugins/module_utils/redfish_utils.py | 4 ++++ 2 files changed, 6 insertions(+) create mode 100644 changelogs/fragments/2040-fix-index-error-in-redfish-set-manager-nic.yml 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]: