get standard properties for each firmware entry (#51028)

This commit is contained in:
Bill Dodd 2019-01-19 15:27:57 -06:00 committed by John R Barker
parent d55479d063
commit 63f7536594

View file

@ -506,26 +506,29 @@ class RedfishUtils(object):
def get_firmware_inventory(self): def get_firmware_inventory(self):
result = {} result = {}
firmware = {}
response = self.get_request(self.root_uri + self.firmware_uri) response = self.get_request(self.root_uri + self.firmware_uri)
if response['ret'] is False: if response['ret'] is False:
return response return response
result['ret'] = True result['ret'] = True
data = response['data'] data = response['data']
result['entries'] = []
for device in data[u'Members']: for device in data[u'Members']:
d = device[u'@odata.id'] uri = self.root_uri + device[u'@odata.id']
d = d.replace(self.firmware_uri, "") # leave just device name # Get details for each device
if "Installed" in d:
uri = self.root_uri + self.firmware_uri + d
# Get details for each device that is relevant
response = self.get_request(uri) response = self.get_request(uri)
if response['ret'] is False: if response['ret'] is False:
return response return response
result['ret'] = True result['ret'] = True
data = response['data'] data = response['data']
firmware[data[u'Name']] = data[u'Version'] firmware = {}
result["entries"] = firmware # Get these standard properties if present
for key in ['Name', 'Id', 'Status', 'Version', 'Updateable',
'SoftwareId', 'LowestSupportedVersion', 'Manufacturer',
'ReleaseDate']:
if key in data:
firmware[key] = data.get(key)
result['entries'].append(firmware)
return result return result
def get_manager_attributes(self): def get_manager_attributes(self):