2
0
mirror of https://opendev.org/x/pyghmi synced 2025-01-29 12:27:37 +00:00

Coerce to str if bytes in python 3

Nextscale code received bytes but needed str.

Change-Id: Ie2951e9689fb7db1c9ff09d04a96acf0b779d638
This commit is contained in:
Jarrod Johnson 2020-07-22 11:58:19 -04:00
parent 2f6c3430c6
commit a30193a974

View File

@ -538,6 +538,8 @@ class SMMClient(object):
if rsp.status != 200:
raise Exception(rsp.read())
indexhtml = rsp.read()
if not isinstance(indexhtml, str):
indexhtml = indexhtml.decode('utf8')
for line in indexhtml.split('\n'):
if '"ST1"' in line:
self.st1 = line.split()[-1].replace(
@ -551,6 +553,8 @@ class SMMClient(object):
body = rsp.read()
if rsp.status != 200:
raise Exception(body)
if not isinstance(body, str):
body = body.decode('utf8')
for line in body.split('\n'):
if '"ST1"' in line:
self.st1 = line.split()[-1].replace(