mirror of
				https://opendev.org/x/pyghmi
				synced 2025-11-03 21:02:26 +00:00 
			
		
		
		
	Fix issues with OEM retrieval
Also small performance boost to XCC3 retrieval. Change-Id: I186c2f87f4dbc213b4a56de3b18de5afcf62f08a
This commit is contained in:
		@@ -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:
 | 
			
		||||
 
 | 
			
		||||
@@ -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"]:
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user