mirror of
https://opendev.org/x/pyghmi
synced 2025-02-20 12:30:48 +00:00
Tolerate unicode strings as username and password
In case of unicode username and password values, just utf-8 encode them. Here, the encoding shouldn't matter much. All parties must agree on encoding, but UTF-8 is fine. Change-Id: Ia4a8a4fcbc5ea9b12ee45ebcc566abe4713b544a
This commit is contained in:
parent
44370a9a0b
commit
bf7dd29a2d
@ -330,16 +330,24 @@ class Session(object):
|
||||
self.cleaningup = False
|
||||
self.lastpayload = None
|
||||
self.bmc = bmc
|
||||
self.userid = userid
|
||||
self.password = password
|
||||
try:
|
||||
self.userid = userid.encode('utf-8')
|
||||
self.password = password.encode('utf-8')
|
||||
except AttributeError:
|
||||
self.userid = userid
|
||||
self.password = password
|
||||
self.nowait = False
|
||||
self.pendingpayloads = collections.deque([])
|
||||
self.request_entry = []
|
||||
self.kgo = kg
|
||||
if kg is not None:
|
||||
try:
|
||||
kg = kg.encode('utf-8')
|
||||
except AttributeError:
|
||||
pass
|
||||
self.kg = kg
|
||||
else:
|
||||
self.kg = password
|
||||
self.kg = self.password
|
||||
self.port = port
|
||||
if (onlogon is None):
|
||||
self.async = False
|
||||
|
Loading…
x
Reference in New Issue
Block a user