From 8c07dc61932133727fe99c2821b33f82c0371e6d Mon Sep 17 00:00:00 2001 From: Jarrod Johnson Date: Tue, 1 Mar 2022 06:30:21 -0500 Subject: [PATCH] Fix Python2 compat in new SDR cache code Python2 bytes type cannot be compared to number. Coerce into a bytearray to have python2 treat them as numbers. Change-Id: I8522b1eb74f4b7aebfa6a0fa68107a0df947c7f6 --- pyghmi/ipmi/sdr.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/pyghmi/ipmi/sdr.py b/pyghmi/ipmi/sdr.py index 24163bba..e07583e0 100644 --- a/pyghmi/ipmi/sdr.py +++ b/pyghmi/ipmi/sdr.py @@ -841,6 +841,8 @@ class SDR(object): False, self.mfg_id, self.prod_id) def add_sdr(self, sdrbytes): + if not isinstance(sdrbytes[0], int): + sdrbytes = bytearray(sdrbytes) newent = self.make_sdr_entry(sdrbytes) if newent.sdrtype == TYPE_SENSOR: id = '{0}.{1}.{2}'.format(