Handle out of order setting instances

The data from the xClarity controller may not be sorted,
apply numeric sort on the way out.

Change-Id: Icd22a140bf6b558703b1006a41047ffbd6a1e3d8
This commit is contained in:
Jarrod Johnson 2024-04-09 09:46:24 -04:00
parent 584c109763
commit ed94d36d18
1 changed files with 7 additions and 1 deletions

View File

@ -372,7 +372,13 @@ class LenovoFirmwareConfig(object):
if not instances:
protect = True # not supported yet
else:
current = [x.text for x in instances]
instbynum = {}
defidx = 1
for x in instances:
xid = int(x.get('ID', defidx))
instbynum[xid] = x
defidx += 1
current = [instbynum[idx].text for idx in sorted(instbynum)]
default = onedata.get('default', None)
if default == '':
default = None