From 24b3d61a401f7ef181ad668d9066d0c1f218a179 Mon Sep 17 00:00:00 2001 From: Jarrod Johnson Date: Fri, 12 Mar 2021 09:52:27 -0500 Subject: [PATCH] Fix TSM LXPM handling For one, check only basename for filename conventions. Secondly, recoginze fw_drv files as being LXPM class. Change-Id: I829e4fe0bf1c1eea2d7ec96c5e4aae9a64010a35 --- pyghmi/redfish/oem/lenovo/tsma.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/pyghmi/redfish/oem/lenovo/tsma.py b/pyghmi/redfish/oem/lenovo/tsma.py index 91b40f01..ac2a5bd6 100644 --- a/pyghmi/redfish/oem/lenovo/tsma.py +++ b/pyghmi/redfish/oem/lenovo/tsma.py @@ -12,6 +12,7 @@ # See the License for the specific language governing permissions and # limitations under the License. +import os import struct import time try: @@ -401,14 +402,16 @@ class TsmHandler(generic.OEMHandler): def update_firmware(self, filename, data=None, progress=None, bank=None): wc = self.wc wc.set_header('Content-Type', 'application/json') + basefilename = os.path.basename(filename) if filename.endswith('.hpm'): return self.update_hpm_firmware(filename, progress, wc, data) - elif 'uefi' in filename and filename.endswith('.rom'): + elif 'uefi' in basefilename and filename.endswith('.rom'): return self.update_sys_firmware(filename, progress, wc, data=data) - elif 'amd-sas' in filename and filename.endswith('.bin'): + elif 'amd-sas' in basefilename and filename.endswith('.bin'): return self.update_sys_firmware(filename, progress, wc, data=data, type='bp') - elif 'lxpm' in filename and filename.endswith('.img'): + elif (('lxpm' in basefilename or 'fw_drv' in basefilename) + and filename.endswith('.img')): return self.update_lxpm_firmware(filename, progress, wc, data) else: raise Exception('Unsupported filename {0}'.format(filename))