From 0c5ca9fcdf38098278f7a5204fd276dd9c56a8cc Mon Sep 17 00:00:00 2001 From: Jarrod Johnson Date: Thu, 20 Jul 2023 14:55:23 -0400 Subject: [PATCH] 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 --- pyghmi/ipmi/oem/lenovo/nextscale.py | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/pyghmi/ipmi/oem/lenovo/nextscale.py b/pyghmi/ipmi/oem/lenovo/nextscale.py index 9bcfba52..de1524a1 100644 --- a/pyghmi/ipmi/oem/lenovo/nextscale.py +++ b/pyghmi/ipmi/oem/lenovo/nextscale.py @@ -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)