From f8b77da3d4d1da27dd55cf4f69fa4ef5e408f48b Mon Sep 17 00:00:00 2001 From: luyf5 Date: Tue, 31 Aug 2021 13:57:20 +0800 Subject: [PATCH] Accept utf8 strings in FRU data https: //gitlab.icelab.lenovo.com/pygcon/pyghmi/commit/09b93e84ba2093ccbd2f7536832cbcf8c15a6abc Accept utf-8 strings in FRU data Some ThinkServers have FRU elements that can return unicode strings. This patch adds support for this data. Change-Id: If64cee6d132272ef1756dfcbdd1e056fafd2a3c2 --- pyghmi/ipmi/oem/lenovo/handler.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/pyghmi/ipmi/oem/lenovo/handler.py b/pyghmi/ipmi/oem/lenovo/handler.py index 480b8c26..a01947a9 100755 --- a/pyghmi/ipmi/oem/lenovo/handler.py +++ b/pyghmi/ipmi/oem/lenovo/handler.py @@ -548,13 +548,13 @@ class OEMHandler(generic.OEMHandler): try: _, _, wwn1, wwn2, mac1, mac2 = fru['board_extra'] if wwn1 not in ('0000000000000000', ''): - fru['WWN 1'] = wwn1 + fru['WWN 1'] = wwn1.encode('utf-8') if wwn2 not in ('0000000000000000', ''): - fru['WWN 2'] = wwn2 + fru['WWN 2'] = wwn2.encode('utf-8') if mac1 not in ('00:00:00:00:00:00', ''): - fru['MAC Address 1'] = mac1 + fru['MAC Address 1'] = mac1.encode('utf-8') if mac2 not in ('00:00:00:00:00:00', ''): - fru['MAC Address 2'] = mac2 + fru['MAC Address 2'] = mac2.encode('utf-8') except (AttributeError, KeyError): pass try: