From de1f5f6c6088d5172d681bde0a49491031fa7d35 Mon Sep 17 00:00:00 2001 From: Jarrod Johnson Date: Fri, 16 Apr 2021 11:26:56 -0400 Subject: [PATCH] Fix user enablement on SMM on python3 Normalize to str to have format available in python 3 environments Change-Id: I09f12d974a77ddf2526da9e6f276402de0cc5b8d --- pyghmi/ipmi/oem/lenovo/nextscale.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/pyghmi/ipmi/oem/lenovo/nextscale.py b/pyghmi/ipmi/oem/lenovo/nextscale.py index 4ab4bfd9..f7f64cbc 100644 --- a/pyghmi/ipmi/oem/lenovo/nextscale.py +++ b/pyghmi/ipmi/oem/lenovo/nextscale.py @@ -540,8 +540,10 @@ class SMMClient(object): if priv.lower() == 'administrator': rsp = self.ipmicmd.xraw_command(netfn=6, command=0x46, data=(uid,)) username = bytes(rsp['data']).rstrip(b'\x00') + if not isinstance(username, str): + username = username.decode('utf8') self.wc.request( - 'POST', '/data', b'set=user({0},1,{1},511,,4,15,0)'.format( + 'POST', '/data', 'set=user({0},1,{1},511,,4,15,0)'.format( uid, username)) rsp = self.wc.getresponse() rsp.read()