From e09da05a45c41a12629c3ed595f2d6fa400f0546 Mon Sep 17 00:00:00 2001 From: Jarrod Johnson Date: Thu, 12 Sep 2024 14:19:27 -0400 Subject: [PATCH] Fix issues with OEM retrieval Also small performance boost to XCC3 retrieval. Change-Id: I186c2f87f4dbc213b4a56de3b18de5afcf62f08a --- pyghmi/redfish/command.py | 2 +- pyghmi/redfish/oem/lenovo/xcc3.py | 15 +++++++-------- 2 files changed, 8 insertions(+), 9 deletions(-) diff --git a/pyghmi/redfish/command.py b/pyghmi/redfish/command.py index dacef586..bf415db0 100644 --- a/pyghmi/redfish/command.py +++ b/pyghmi/redfish/command.py @@ -996,6 +996,7 @@ class Command(object): {'HostName': hostname}, 'PATCH') def get_firmware(self, components=()): + self._fwnamemap = {} try: for firminfo in self.oem.get_firmware_inventory(components, self): yield firminfo @@ -1003,7 +1004,6 @@ class Command(object): return fwlist = self._do_web_request(self._fwinventory) fwurls = [x['@odata.id'] for x in fwlist.get('Members', [])] - self._fwnamemap = {} for res in self._do_bulk_requests(fwurls): res = self._extract_fwinfo(res) if res[0] is None: diff --git a/pyghmi/redfish/oem/lenovo/xcc3.py b/pyghmi/redfish/oem/lenovo/xcc3.py index f0f2abc5..77cf4154 100644 --- a/pyghmi/redfish/oem/lenovo/xcc3.py +++ b/pyghmi/redfish/oem/lenovo/xcc3.py @@ -1,3 +1,4 @@ +import copy import pyghmi.redfish.oem.generic as generic import pyghmi.exceptions as pygexc @@ -97,16 +98,14 @@ class OEMHandler(generic.OEMHandler): return currsettings, reginfo def get_firmware_inventory(self, components, fishclient): - fwlist = fishclient._do_web_request(fishclient._fwinventory) - rawfwurls = [x['@odata.id'] for x in fwlist.get('Members', [])] - fwurls = [] - for fwurl in rawfwurls: + fwlist = fishclient._do_web_request(fishclient._fwinventory + '?$expand=.') + fwlist = copy.deepcopy(fwlist.get('Members', [])) + self._fwnamemap = {} + for redres in fwlist: + fwurl = redres['@odata.id'] + res = (redres, fwurl) if fwurl.startswith('/redfish/v1/UpdateService/FirmwareInventory/Bundle.'): continue # skip Bundle information for now - fwurls.append(fwurl) - self._fwnamemap = {} - for res in fishclient._do_bulk_requests(fwurls): - redres = res[0] if redres.get('Name', '').startswith('Firmware:'): redres['Name'] = redres['Name'].replace('Firmware:', '') if redres['Name'].startswith('Firmware-PSoC') and 'Drive_Backplane' in redres["@odata.id"]: