2
0
mirror of https://opendev.org/x/pyghmi synced 2025-07-24 21:21:17 +00:00

Do not raise on bad/unsupported FRU data

If a FRU device presents data that pyghmi does not understand,
treat it the same way as if it were not present, do not decode.
Some systems simply do not have usable FRU data despite having a
pointer to a FRU device.

Change-Id: I440cee3366b5da4555b67b41492fa017dbe3dcef
This commit is contained in:
Jarrod Johnson
2015-10-26 10:08:21 -04:00
parent d25caa1aad
commit 9b6e6b9ba0

View File

@@ -186,16 +186,21 @@ class FRU(object):
frutype = self.sdr.fru_type_and_modifier >> 8
frusubtype = self.sdr.fru_type_and_modifier & 0xff
if frutype > 0x10 or frutype < 0x8 or frusubtype not in (0, 1, 2):
raise iexc.PyghmiException(
'Unsupported FRU device: {0:x}h, {1:x}h'.format(frutype,
frusubtype
))
return
#TODO(jjohnson2): strict mode to detect pyghmi and BMC
#gaps
# raise iexc.PyghmiException(
# 'Unsupported FRU device: {0:x}h, {1:x}h'.format(frutype,
# frusubtype
# ))
elif frusubtype == 1:
self.myspd = spd.SPD(self.databytes)
self.info = self.myspd.info
return
if self.databytes[0] != 1:
raise iexc.BmcErrorException("Invalid/Unsupported FRU format")
return
#TODO(jjohnson2): strict mode to flag potential BMC errors
# raise iexc.BmcErrorException("Invalid/Unsupported FRU format")
# Ignore the internal use even if present.
self._parse_chassis()
self._parse_board()