Better tolerate issues during pause

Unrelated issue can derail an update process. Make pause
unlikely to throw unexpected issues, but print it out
just in case.

Further, give a hint when one specific scenario comes up that was
seen and hard to debug.

Change-Id: I635d3fc8df10b9bee9fc261d88beb7002b689a7e
This commit is contained in:
Jarrod Johnson 2021-12-15 09:35:12 -05:00
parent e5d059e389
commit 3606780826

View File

@ -1115,9 +1115,12 @@ class Session(object):
@classmethod
def pause(cls, timeout):
starttime = _monotonic_time()
while _monotonic_time() - starttime < timeout:
cls.wait_for_rsp(timeout - (_monotonic_time() - starttime))
try:
starttime = _monotonic_time()
while _monotonic_time() - starttime < timeout:
cls.wait_for_rsp(timeout - (_monotonic_time() - starttime))
except Exception as e:
print(repr(e))
@classmethod
def wait_for_rsp(cls, timeout=None, callout=True):
@ -1529,8 +1532,12 @@ class Session(object):
+ self.remoteguid + struct.pack(
"2B", self.nameonly | self.privlevel, userlen)
+ self.userid)
expectedhash = hmac.new(self.password, hmacdata,
self.currhashlib).digest()
try:
expectedhash = hmac.new(self.password, hmacdata,
self.currhashlib).digest()
except TypeError:
print('Password for {0} is somehow malformed'.format(self.bmc))
return -9
hashlen = len(expectedhash)
givenhash = struct.pack("%dB" % hashlen, *data[40:hashlen + 40])
if givenhash != expectedhash: