From 4bbf63c96b2d02afec4c5fc1be9588e5a7c6b467 Mon Sep 17 00:00:00 2001 From: Jarrod Johnson Date: Fri, 21 Feb 2025 12:23:35 -0500 Subject: [PATCH] Fix numeric indexs into configuration Settings may dictate the index, and we must preserve that. Change-Id: Idd010e81013df26bcddb12f1654f259175e4dd70 --- pyghmi/ipmi/oem/lenovo/config.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/pyghmi/ipmi/oem/lenovo/config.py b/pyghmi/ipmi/oem/lenovo/config.py index 3a4475c8..3a989ff8 100644 --- a/pyghmi/ipmi/oem/lenovo/config.py +++ b/pyghmi/ipmi/oem/lenovo/config.py @@ -351,6 +351,7 @@ class LenovoFirmwareConfig(object): readonly = 'true' possible = [] current = None + currentidxes = [] default = None reset = False name = setting.find("mriName").text @@ -381,6 +382,7 @@ class LenovoFirmwareConfig(object): instbynum[xid] = x defidx += 1 current = [instbynum[idx].text for idx in sorted(instbynum)] + currentidxes = list(sorted(instbynum)) default = onedata.get('default', None) if default == '': default = None @@ -442,6 +444,8 @@ class LenovoFirmwareConfig(object): if current and len(current) > 1: instidx = 1 for inst in current: + if currentidxes: + instidx = currentidxes.pop(0) optname = '{0}.{1}'.format(optionname, instidx) options[optname] = dict( current=inst,