mirror of
https://opendev.org/x/pyghmi
synced 2025-02-04 21:12:47 +00:00
Reset seek on unwrapped zip
If the zip payload is passed through as-is, then make sure to seek if the filehandle is open. Change-Id: I04702da72d63b4edd7841e1b4f55704a92522ba9
This commit is contained in:
parent
b1a693a0e7
commit
9c84b8ad50
@ -1994,8 +1994,10 @@ class XCCClient(IMMClient):
|
||||
z = None
|
||||
wrappedfilename = None
|
||||
uxzcount = 0
|
||||
needseek = False
|
||||
if data and hasattr(data, 'read'):
|
||||
if zipfile.is_zipfile(data):
|
||||
needseek = True
|
||||
z = zipfile.ZipFile(data)
|
||||
else:
|
||||
data.seek(0)
|
||||
@ -2010,6 +2012,8 @@ class XCCClient(IMMClient):
|
||||
if uxzcount == 1 and wrappedfilename:
|
||||
filename = os.path.basename(wrappedfilename)
|
||||
data = z.open(wrappedfilename)
|
||||
elif needseek:
|
||||
data.seek(0)
|
||||
upurl = usd['HttpPushUri']
|
||||
self.grab_redfish_response_with_status(
|
||||
'/redfish/v1/UpdateService',
|
||||
|
@ -1200,8 +1200,10 @@ class OEMHandler(generic.OEMHandler):
|
||||
z = None
|
||||
wrappedfilename = None
|
||||
uxzcount = 0
|
||||
needseek = False
|
||||
if data and hasattr(data, 'read'):
|
||||
if zipfile.is_zipfile(data):
|
||||
needseek = True
|
||||
z = zipfile.ZipFile(data)
|
||||
else:
|
||||
data.seek(0)
|
||||
@ -1216,6 +1218,8 @@ class OEMHandler(generic.OEMHandler):
|
||||
if uxzcount == 1 and wrappedfilename:
|
||||
filename = os.path.basename(wrappedfilename)
|
||||
data = z.open(wrappedfilename)
|
||||
elif needseek:
|
||||
data.seek(0)
|
||||
upurl = usd['HttpPushUri']
|
||||
self._do_web_request(
|
||||
'/redfish/v1/UpdateService',
|
||||
|
Loading…
x
Reference in New Issue
Block a user