From eb86ea1ff86616ea456eb79f432ec96b6b75d606 Mon Sep 17 00:00:00 2001 From: Jarrod Johnson Date: Wed, 25 May 2016 15:06:06 -0400 Subject: [PATCH] Fix KeyError due to lazy use of raw_command xraw_command is the version intended to be lazily used, switch to that version to make the SDR code more robust. Change-Id: I1e9b799dd21861fa602db6a1d474334e88915c38 --- pyghmi/ipmi/sdr.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/pyghmi/ipmi/sdr.py b/pyghmi/ipmi/sdr.py index e011d88b..5d7738e1 100644 --- a/pyghmi/ipmi/sdr.py +++ b/pyghmi/ipmi/sdr.py @@ -592,7 +592,8 @@ class SDR(object): def read_info(self): #first, we want to know the device id - rsp = self.ipmicmd.raw_command(netfn=6, command=1) + rsp = self.ipmicmd.xraw_command(netfn=6, command=1) + rsp['data'] = bytearray(rsp['data']) self.device_id = rsp['data'][0] self.device_rev = rsp['data'][1] & 0b111 # Going to ignore device available until get sdr command @@ -619,7 +620,8 @@ class SDR(object): return rsp['data'][0] + (rsp['data'][1] << 8) def get_sdr(self): - repinfo = self.ipmicmd.raw_command(netfn=0x0a, command=0x20) + repinfo = self.ipmicmd.xraw_command(netfn=0x0a, command=0x20) + repinfo['data'] = bytearray(repinfo['data']) if (repinfo['data'][0] != 0x51): # we only understand SDR version 51h, the only version defined # at time of this writing