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:
parent
951f1bb3f4
commit
9ccd587581
@ -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'
|
||||
|
Loading…
x
Reference in New Issue
Block a user