From 93bf10d7d07b19be8f0e3b7bbfc85f0281a680a6 Mon Sep 17 00:00:00 2001 From: Jarrod Johnson Date: Fri, 2 Feb 2018 16:16:22 -0500 Subject: [PATCH] Convert to using xraw_command It is more efficient and exception based Change-Id: Icddfb7272d9839e7ff74905132dc23276ce60b24 --- pyghmi/ipmi/oem/lenovo/config.py | 33 ++++++++++++++++---------------- pyghmi/ipmi/oem/lenovo/imm.py | 3 ++- 2 files changed, 18 insertions(+), 18 deletions(-) diff --git a/pyghmi/ipmi/oem/lenovo/config.py b/pyghmi/ipmi/oem/lenovo/config.py index 9033e484..9e29c176 100644 --- a/pyghmi/ipmi/oem/lenovo/config.py +++ b/pyghmi/ipmi/oem/lenovo/config.py @@ -55,10 +55,10 @@ class LenovoFirmwareConfig(object): for i in range(len(filename)): data += [ord(filename[i])] - response = self.connection.raw_command(netfn=IMM_NETFN, - command=IMM_COMMAND, data=data) + response = self.connection.xraw_command(netfn=IMM_NETFN, + command=IMM_COMMAND, data=data) - size = ''.join(chr(c) for c in response['data'][3:7]) + size = response['data'][3:7] size = struct.unpack("i", size) return size[0] @@ -84,9 +84,9 @@ class LenovoFirmwareConfig(object): while retries: retries = retries-1 - response = self.connection.raw_command(netfn=IMM_NETFN, - command=IMM_COMMAND, - data=data) + response = self.connection.xraw_command(netfn=IMM_NETFN, + command=IMM_COMMAND, + data=data) try: if response['code'] == 0 or retries == 0: break @@ -94,7 +94,7 @@ class LenovoFirmwareConfig(object): pass self.connection.ipmi_session.pause(5) - filehandle = ''.join(chr(byte) for byte in response['data'][3:7]) + filehandle = response['data'][3:7] filehandle = struct.unpack("