mirror of
https://opendev.org/x/pyghmi
synced 2025-02-04 21:12:47 +00:00
Add retry logic to web fetch
While UEFI configuration is always handy, reads to the IMM section may require wait and retry. Change-Id: I7fe97124897fca6e928c3699171bfbe676d699e1
This commit is contained in:
parent
e4a48e9072
commit
44733d19b0
@ -23,6 +23,7 @@ import random
|
||||
import struct
|
||||
|
||||
import six
|
||||
import time
|
||||
|
||||
import pyghmi.exceptions as pygexc
|
||||
|
||||
@ -285,9 +286,19 @@ class LenovoFirmwareConfig(object):
|
||||
else:
|
||||
rsp = (None, 500)
|
||||
if rsp[1] == 200:
|
||||
data = rsp[0]['Content']
|
||||
data = base64.b64decode(data)
|
||||
data = EfiCompressor.FrameworkDecompress(data, len(data))
|
||||
for _ in range(0, 30):
|
||||
data = rsp[0]['Content']
|
||||
data = base64.b64decode(data)
|
||||
data = EfiCompressor.FrameworkDecompress(data, len(data))
|
||||
if len(data) != 0:
|
||||
break
|
||||
if self.connection:
|
||||
self.connection.ipmi_session.pause(2)
|
||||
else:
|
||||
time.sleep(2)
|
||||
rsp = self.xc.grab_redfish_response_with_status(
|
||||
'/redfish/v1/Systems/1/Actions/Oem/LenovoComputerSystem.DSReadFile',
|
||||
{'Action': 'DSReadFile', 'FileName': cfgfilename})
|
||||
else:
|
||||
if self.connection is None:
|
||||
raise Unsupported('Not Supported')
|
||||
|
Loading…
x
Reference in New Issue
Block a user