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

Trigger unwrapping only with singular update

A compound update may contain multiple updates with
json directions on processing.

Activate uxz unwrapping only
with singular payload that ends
in uxz.

Change-Id: I5fb3d158a33f696a7e2fb5143e703de4c9408e7a
This commit is contained in:
Jarrod Johnson 2023-07-26 15:29:18 -04:00
parent e2f15bde4d
commit 212f0df227
2 changed files with 18 additions and 8 deletions

View File

@ -1987,6 +1987,8 @@ class XCCClient(IMMClient):
raise pygexc.TemporaryError('Cannot run multiple updates to same '
'target concurrently')
z = None
wrappedfilename = None
uxzcount = 0
if data and hasattr(data, 'read'):
if zipfile.is_zipfile(data):
z = zipfile.ZipFile(data)
@ -1996,10 +1998,13 @@ class XCCClient(IMMClient):
z = zipfile.ZipFile(filename)
if z:
for tmpname in z.namelist():
if tmpname.endswith('.uxz'):
filename = tmpname
data = z.open(filename)
break
if tmpname.startswith('payloads/'):
uxzcount += 1
if tmpname.endswith('.uxz'):
wrappedfilename = tmpname
if uxzcount == 1 and wrappedfilename:
filename = os.path.basename(wrappedfilename)
data = z.open(wrappedfilename)
upurl = usd['HttpPushUri']
self.grab_redfish_response_with_status(
'/redfish/v1/UpdateService',

View File

@ -1193,6 +1193,8 @@ class OEMHandler(generic.OEMHandler):
raise pygexc.TemporaryError('Cannot run multtiple updates to '
'same target concurrently')
z = None
wrappedfilename = None
uxzcount = 0
if data and hasattr(data, 'read'):
if zipfile.is_zipfile(data):
z = zipfile.ZipFile(data)
@ -1202,10 +1204,13 @@ class OEMHandler(generic.OEMHandler):
z = zipfile.ZipFile(filename)
if z:
for tmpname in z.namelist():
if tmpname.endswith('.uxz'):
filename = tmpname
data = z.open(filename)
break
if tmpname.startswith('payloads/'):
uxzcount += 1
if tmpname.endswith('.uxz'):
wrappedfilename = tmpname
if uxzcount == 1 and wrappedfilename:
filename = os.path.basename(wrappedfilename)
data = z.open(wrappedfilename)
upurl = usd['HttpPushUri']
self._do_web_request(
'/redfish/v1/UpdateService',