diff --git a/pyghmi/ipmi/oem/lenovo/config.py b/pyghmi/ipmi/oem/lenovo/config.py index f51eae45..1badb6d5 100644 --- a/pyghmi/ipmi/oem/lenovo/config.py +++ b/pyghmi/ipmi/oem/lenovo/config.py @@ -305,6 +305,10 @@ class LenovoFirmwareConfig(object): readonly = setting.get('gray-if') if readonly: readonly = _convert_syntax(readonly) + else: + access = setting.get('access') + if access == 'readonly': + readonly = 'true' possible = [] current = None default = None @@ -485,10 +489,6 @@ class LenovoFirmwareConfig(object): for option in options.keys(): if options[option]['new_value'] is None: continue - if options[option]['current'] == options[option]['new_value']: - continue - if options[option]['pending'] == options[option]['new_value']: - continue if options[option]['readonly']: errstr = '{0} is read only'.format(option) if options[option]['readonly_why']: @@ -496,6 +496,10 @@ class LenovoFirmwareConfig(object): ','.join(sorted(options[option]['readonly_why']))) errstr += ea raise pygexc.InvalidParameterValue(errstr) + if options[option]['current'] == options[option]['new_value']: + continue + if options[option]['pending'] == options[option]['new_value']: + continue if isinstance(options[option]['new_value'], six.string_types): # Coerce a simple string parameter to the expected list format options[option]['new_value'] = [options[option]['new_value']] diff --git a/pyghmi/ipmi/oem/lenovo/handler.py b/pyghmi/ipmi/oem/lenovo/handler.py index 79291130..480b8c26 100755 --- a/pyghmi/ipmi/oem/lenovo/handler.py +++ b/pyghmi/ipmi/oem/lenovo/handler.py @@ -528,7 +528,7 @@ class OEMHandler(generic.OEMHandler): data=(id_,)) except pygexc.IpmiException: continue # Ignore LEDs we can't retrieve - status = led_status.get(ord(rsp['data'][0]), + status = led_status.get(bytearray(rsp['data'][:])[0], led_status_default) yield (name, {'status': status}) @@ -821,9 +821,12 @@ class OEMHandler(generic.OEMHandler): data=(0x01, 0xc5, 0x00, 0x00))["data"][1:] if not ipv6_addr: return - ipv6_prefix = ord(self.ipmicmd.xraw_command( + rspdata = self.ipmicmd.xraw_command( netfn=0xc, command=0x02, - data=(0x1, 0xc6, 0, 0))['data'][1]) + data=(0x1, 0xc6, 0, 0))['data'] + ipv6_prefix_ba = bytearray(rspdata) + ipv6_prefix = ipv6_prefix_ba[1] + if hasattr(socket, 'inet_ntop'): ipv6str = socket.inet_ntop(socket.AF_INET6, ipv6_addr) else: diff --git a/pyghmi/ipmi/oem/lenovo/inventory.py b/pyghmi/ipmi/oem/lenovo/inventory.py index 6f246e85..248b0e60 100755 --- a/pyghmi/ipmi/oem/lenovo/inventory.py +++ b/pyghmi/ipmi/oem/lenovo/inventory.py @@ -68,7 +68,7 @@ def parse_inventory_category(name, info, countable=True): cur = 0 if countable: - count = struct.unpack("B", raw[cur])[0] + count = bytearray(raw)[cur] cur += 1 else: count = 0 @@ -127,7 +127,7 @@ def parse_inventory_category_entry(raw, fields): continue if (field.fmt[-1] == "s"): - value = value.rstrip("\x00") + value = value.rstrip(b'\x00') if (field.mapper and value in field.mapper): value = field.mapper[value] if (field.valuefunc): diff --git a/pyghmi/ipmi/private/spd.py b/pyghmi/ipmi/private/spd.py index 5acf45a4..c00de3f2 100644 --- a/pyghmi/ipmi/private/spd.py +++ b/pyghmi/ipmi/private/spd.py @@ -736,7 +736,7 @@ class SPD(object): self.info['serial'] = hex(struct.unpack( '>I', struct.pack('4B', *spd[122:126]))[0])[2:].rjust(8, '0') self.info['model'] = struct.pack('18B', *spd[128:146]).strip( - '\x00\xff ') + b'\x00\xff ') def _decode_ddr4(self): spd = self.rawdata