2
0
mirror of https://opendev.org/x/pyghmi synced 2025-12-06 17:01:55 +00:00

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
This commit is contained in:
Jarrod Johnson
2020-01-22 11:24:30 -05:00
parent fb9b371d38
commit e58de7e0b7

View File

@@ -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 '