From 90a9be1344585156d42b33bf0bbb348066e07f07 Mon Sep 17 00:00:00 2001 From: Jarrod Johnson Date: Fri, 8 Feb 2019 14:31:54 -0500 Subject: [PATCH] Be compatible with wheezy python Debian wheezy has a python vintage that errors on unpack from a bytearray. Explicitly cast to bytes for unpack to compensate. Change-Id: Icaf3931a905102e6ee6ef03d91617c031a1afc86 --- pyghmi/ipmi/private/session.py | 54 ++++++++++++++++------------------ pyghmi/ipmi/sdr.py | 2 +- 2 files changed, 26 insertions(+), 30 deletions(-) diff --git a/pyghmi/ipmi/private/session.py b/pyghmi/ipmi/private/session.py index 0cd20439..313ae6d5 100644 --- a/pyghmi/ipmi/private/session.py +++ b/pyghmi/ipmi/private/session.py @@ -966,7 +966,7 @@ class Session(object): self.onlogon({'error': errstr}) return data = response['data'] - self.sessionid = struct.unpack(" 16: raise exc.IpmiException( "Username too long for IPMI, must not exceed 16") padneeded = 16 - len(self.userid) userid = self.userid + ('\x00' * padneeded) - reqdata += struct.unpack("!16B", userid) + reqdata += userid self.ipmicallback = self._got_session_challenge self._send_ipmi_net_payload(netfn=0x6, command=0x39, data=reqdata) @@ -1036,18 +1035,18 @@ class Session(object): # login attempts from the past self.localsid += 1 self.rmcptag += 1 - data = [ + data = bytearray([ self.rmcptag, 0, # request as much privilege as the channel will give us 0, 0, # reserved - ] - data += list(struct.unpack("4B", struct.pack("