2
0
mirror of https://opendev.org/x/pyghmi synced 2025-02-26 15:21:05 +00:00

Fix numeric indexs into configuration

Settings may dictate the index, and we must preserve that.

Change-Id: Idd010e81013df26bcddb12f1654f259175e4dd70
This commit is contained in:
Jarrod Johnson 2025-02-21 12:23:35 -05:00
parent 345fd8b44e
commit 4bbf63c96b

View File

@ -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,