Apply uxz payload rather than whole zip to XCC

XCC updates are now wrapped in .zip for newer platforms,
however the XCC is more robust at handling uxz.

Change-Id: I90d70ab167e44737bc785e4ed88b9f9890a545a7
This commit is contained in:
Jarrod Johnson 2023-07-26 13:12:18 -04:00
parent 9a307a0c4e
commit e2f15bde4d
2 changed files with 30 additions and 0 deletions

View File

@ -28,6 +28,7 @@ import struct
import weakref
import six
import zipfile
import pyghmi.constants as pygconst
import pyghmi.exceptions as pygexc
@ -1985,6 +1986,20 @@ class XCCClient(IMMClient):
if usd['HttpPushUriTargetsBusy']:
raise pygexc.TemporaryError('Cannot run multiple updates to same '
'target concurrently')
z = None
if data and hasattr(data, 'read'):
if zipfile.is_zipfile(data):
z = zipfile.ZipFile(data)
else:
data.seek(0)
elif data is None and zipfile.is_zipfile(filename):
z = zipfile.ZipFile(filename)
if z:
for tmpname in z.namelist():
if tmpname.endswith('.uxz'):
filename = tmpname
data = z.open(filename)
break
upurl = usd['HttpPushUri']
self.grab_redfish_response_with_status(
'/redfish/v1/UpdateService',

View File

@ -24,6 +24,7 @@ import socket
import time
import six
import zipfile
import pyghmi.constants as pygconst
import pyghmi.exceptions as pygexc
@ -1191,6 +1192,20 @@ class OEMHandler(generic.OEMHandler):
if usd['HttpPushUriTargetsBusy']:
raise pygexc.TemporaryError('Cannot run multtiple updates to '
'same target concurrently')
z = None
if data and hasattr(data, 'read'):
if zipfile.is_zipfile(data):
z = zipfile.ZipFile(data)
else:
data.seek(0)
elif data is None and zipfile.is_zipfile(filename):
z = zipfile.ZipFile(filename)
if z:
for tmpname in z.namelist():
if tmpname.endswith('.uxz'):
filename = tmpname
data = z.open(filename)
break
upurl = usd['HttpPushUri']
self._do_web_request(
'/redfish/v1/UpdateService',