From e58de7e0b7f10d15f4a1a008d66c1d79a91d590d Mon Sep 17 00:00:00 2001 From: Jarrod Johnson Date: Wed, 22 Jan 2020 11:24:30 -0500 Subject: [PATCH] Fix python 3 incompatibility in the FPC/SMM code The use of ord against a bytes object is not supported in python 3. Change to a bytearray for compatibility with both python 2 and 3. Change-Id: I583c83d88c063aac2c085ac6dac8a23211a2f3eb --- pyghmi/ipmi/oem/lenovo/nextscale.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pyghmi/ipmi/oem/lenovo/nextscale.py b/pyghmi/ipmi/oem/lenovo/nextscale.py index b0a4efa6..1637d0ae 100644 --- a/pyghmi/ipmi/oem/lenovo/nextscale.py +++ b/pyghmi/ipmi/oem/lenovo/nextscale.py @@ -104,7 +104,7 @@ def fpc_get_nodeperm(ipmicmd, number, sz): rsp['data'] = b'\x00' + bytes(rsp['data']) elif len(rsp['data']) == 6: # New FPC format rsp['data'] = rsp['data'][:2] + rsp['data'][3:] - perminfo = ord(rsp['data'][1]) + perminfo = bytearray(rsp['data'])[1] if sz == 6: # FPC permfail = ('\x02', '\x03') elif sz == 2: # SMM @@ -291,7 +291,7 @@ class SMMClient(object): settings[rule] = {'value': int( accountinfo.find(self.rulemap[rule]).text)} rsp = self.ipmicmd.xraw_command(0x34, 3) - fanmode = self.fanmodes[ord(rsp['data'][0])] + fanmode = self.fanmodes[bytearray(rsp['data'])[0]] settings['fanspeed'] = { 'value': fanmode, 'default': 'Normal', 'help': ('Adjust the fan speed of the D2 Chassis. Capped settings '