2
0
mirror of https://opendev.org/x/pyghmi synced 2025-01-27 19:37:44 +00:00

Fix firmware info on incomplete data

The UEFI information may be incomplete.  Gracefully degrade as required.

Change-Id: I37b58a7ff3c0e9c1ccc08019202783fb79e8f4a7
This commit is contained in:
Jarrod Johnson 2019-11-05 11:38:00 -05:00
parent 951f1bb3f4
commit 9ccd587581

View File

@ -95,14 +95,16 @@ class TsmHandler(generic.OEMHandler):
wc = self.wc
fwinf = wc.grab_json_response('/api/DeviceVersion')
for biosinf in fwinf:
if biosinf['device'] != 1:
if biosinf.get('device', None) != 1:
continue
biosinf = fwinf[1]
if not biosinf.get('buildname', False):
break
biosres = {
'version': '{0}.{1}'.format(
biosinf['main'][0], biosinf['main'][1:]),
'build': biosinf['buildname']
}
if biosinf.get('main', False):
biosres['version'] = '{0}.{1}'.format(
biosinf['main'][0], biosinf['main'][1:]),
yield ('UEFI', biosres)
break
name = 'TSM'