2
0
mirror of https://github.com/xcat2/confluent.git synced 2024-11-25 19:10:10 +00:00

Normalize uid

python2 was crashing when getting unicode over the link.
This commit is contained in:
Jarrod Johnson 2022-10-13 17:52:26 -04:00
parent 730af73069
commit c3afd45475

View File

@ -2470,6 +2470,11 @@ class ConfigManager(object):
for user in tmpconfig[confarea]:
ucfg = tmpconfig[confarea][user]
uid = ucfg.get('id', None)
if uid is not None and not isinstance(uid, str):
if isinstance(uid, bytes):
uid = uid.decode('utf8')
else:
uid = uid.encode('utf8')
displayname = ucfg.get('displayname', None)
role = ucfg.get('role', None)
self.create_user(user, uid=uid, displayname=displayname, role=role)