2
0
mirror of https://github.com/xcat2/confluent.git synced 2025-01-11 10:18:00 +00:00

Strip newline after decode

strip on bytes in python3 does not remove newlines.
Call after decode to have strip handle the newline.
This commit is contained in:
Jarrod Johnson 2020-07-01 10:32:11 -04:00
parent dfa636ac4c
commit b372a15c33

View File

@ -14,7 +14,7 @@ def get_apikey(nodename, mgr):
return open('/etc/confluent/confluent.apikey').read().strip()
apikey = subprocess.check_output(['/opt/confluent/bin/clortho', nodename, mgr])
if not isinstance(apikey, str):
apikey = apikey.decode('utf8')
apikey = apikey.decode('utf8').strip()
with open('/etc/confluent/confluent.apikey', 'w+') as apiout:
apiout.write(apikey)
os.chmod('/etc/confluent/confluent.apikey', 0o600)