2
0
mirror of https://opendev.org/x/pyghmi synced 2025-11-09 23:50:37 +00:00

Fix NTP configuration of FPC/SMM with py3

Under pythton3, we have another case of one
thing defaulting to bytes and a str. Explicitly
decode from utf8 in such a case.

Change-Id: Icbf6ad375e6398d12656ab4ddc8d0f248fe1cc73
This commit is contained in:
Jarrod Johnson
2020-08-21 10:46:27 -04:00
parent d0ae49fdf5
commit 45c04fce95

View File

@@ -634,6 +634,8 @@ class SMMClient(object):
1 if enabled else 0))
rsp = self.wc.getresponse()
result = rsp.read()
if not isinstance(result, str):
result = result.decode('utf8')
self.logout()
if '<status>ok</status>' not in result:
raise Exception("Unrecognized result: " + result)
@@ -643,6 +645,8 @@ class SMMClient(object):
index + 1, server))
rsp = self.wc.getresponse()
result = rsp.read()
if not isinstance(result, str):
result = result.decode('utf8')
if '<status>ok</status>' not in result:
raise Exception("Unrecognized result: " + result)
self.logout()