2
0
mirror of https://opendev.org/x/pyghmi synced 2025-01-27 03:17:50 +00:00

Avoid error on unexpected shutdown

SMM may reboot at any moment without warning after
finishing an update.

Assume good news if this should happen.

Change-Id: I841780bad9f9ca49b0fbc7c58652e569a3c0a638
This commit is contained in:
Jarrod Johnson 2023-07-20 14:55:23 -04:00
parent c0927c9f2e
commit 0c5ca9fcdf

View File

@ -1028,11 +1028,18 @@ class SMMClient(object):
rsp = wc.getresponse()
rsp.read()
complete = False
tries = 0
while not complete:
ipmisession.Session.pause(3)
wc.request('POST', '/data', 'get=fwProgress,fwUpdate')
rsp = wc.getresponse()
progdata = rsp.read()
try:
rsp = wc.getresponse()
progdata = rsp.read()
except Exception:
if tries > 2:
break
tries += 1
continue
if rsp.status != 200:
raise Exception('Error applying firmware')
progdata = fromstring(progdata)