From ed94d36d184b61b98f5c3d6b0cb1867f6f249d7d Mon Sep 17 00:00:00 2001 From: Jarrod Johnson Date: Tue, 9 Apr 2024 09:46:24 -0400 Subject: [PATCH] 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 --- pyghmi/ipmi/oem/lenovo/config.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/pyghmi/ipmi/oem/lenovo/config.py b/pyghmi/ipmi/oem/lenovo/config.py index 4f7d9c47..a8747562 100644 --- a/pyghmi/ipmi/oem/lenovo/config.py +++ b/pyghmi/ipmi/oem/lenovo/config.py @@ -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