2
0
mirror of https://opendev.org/x/pyghmi synced 2025-01-15 12:17:44 +00:00

Tolerate missing UUID

Some Thinkservers may be missing the UUID field.  Tolerate
this scenario gracefully.

Change-Id: I43793b509030be9b7c161d8fee80cf67b831bbdd
This commit is contained in:
Jarrod Johnson 2015-05-14 14:46:45 -04:00
parent 006710f1e8
commit c1f6cacd95

View File

@ -42,16 +42,19 @@ class OEMHandler(generic.OEMHandler):
fru['MAC Address 1'] = mac1
if mac2 not in ('00:00:00:00:00:00', ''):
fru['MAC Address 2'] = mac2
try:
# The product_extra field is UUID as the system would present
# in DMI. This is different than the two UUIDs that
# it returns for get device and get system uuid...
byteguid = fru['product_extra'][0]
byteguid = fru['product_extra'][0]
# It can present itself as claiming to be ASCII when it
# is actually raw hex. As a result it triggers the mechanism
# to strip \x00 from the end of text strings. Work around this
# by padding with \x00 to the right if the string is not 16 long
byteguid.extend('\x00' * (16 - len(byteguid)))
fru['UUID'] = util.decode_wireformat_uuid(byteguid)
byteguid.extend('\x00' * (16 - len(byteguid)))
fru['UUID'] = util.decode_wireformat_uuid(byteguid)
except (AttributeError, KeyError):
pass
return fru
else:
fru['oem_parser'] = None