mirror of
https://opendev.org/x/pyghmi
synced 2025-01-27 19:37:44 +00:00
Error if TSM fails to provide info
TSM may be in a state that cannot provide firmware information, raise an exception in such an event. Change-Id: I8706624f4b46e12b470a78949ea429469e2d9640
This commit is contained in:
parent
9ccd587581
commit
ce71add93d
@ -93,7 +93,11 @@ class TsmHandler(generic.OEMHandler):
|
||||
|
||||
def get_firmware_inventory(self, components, raisebypass=True):
|
||||
wc = self.wc
|
||||
fwinf = wc.grab_json_response('/api/DeviceVersion')
|
||||
fwinf, status = wc.grab_json_response_with_status(
|
||||
'/api/DeviceVersion')
|
||||
gotinfo = False
|
||||
if status < 200 or status >= 300:
|
||||
raise Exception('Error connecting to HTTP API')
|
||||
for biosinf in fwinf:
|
||||
if biosinf.get('device', None) != 1:
|
||||
continue
|
||||
@ -106,6 +110,7 @@ class TsmHandler(generic.OEMHandler):
|
||||
biosres['version'] = '{0}.{1}'.format(
|
||||
biosinf['main'][0], biosinf['main'][1:]),
|
||||
yield ('UEFI', biosres)
|
||||
gotinfo = True
|
||||
break
|
||||
name = 'TSM'
|
||||
fwinf = wc.grab_json_response('/api/get-sysfwinfo')
|
||||
@ -116,7 +121,10 @@ class TsmHandler(generic.OEMHandler):
|
||||
'date': cinf['builddate'],
|
||||
}
|
||||
yield (name, bmcinf)
|
||||
gotinfo = True
|
||||
name += ' Backup'
|
||||
if not gotinfo:
|
||||
raise Exception("Unable to retrieve firmware information")
|
||||
if raisebypass:
|
||||
raise exc.BypassGenericBehavior()
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user