From 6662bd99311c1af877a1afe9777b2a782ace4081 Mon Sep 17 00:00:00 2001 From: "patchback[bot]" <45432694+patchback[bot]@users.noreply.github.com> Date: Fri, 19 Mar 2021 21:38:20 +0100 Subject: [PATCH] Fix IndexError in SetManagerNic (#2040) (#2048) * fix IndexError in SetManagerNic * add changelog fragment (cherry picked from commit 0b2ebabd29a7ac1e6a4278318f4c8a0cc436132a) Co-authored-by: Bill Dodd --- .../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 8f14dbad78..99e5852b09 100644 --- a/plugins/module_utils/redfish_utils.py +++ b/plugins/module_utils/redfish_utils.py @@ -2676,6 +2676,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]: