mirror of
https://github.com/xcat2/confluent.git
synced 2025-02-02 20:13:26 +00:00
Fix apikey strip for python2
Strip after any conversions, whether it is bytes or str.
This commit is contained in:
parent
85241a488a
commit
004e609635
@ -14,9 +14,10 @@ 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').strip()
|
||||
apikey = apikey.decode('utf8')
|
||||
with open('/etc/confluent/confluent.apikey', 'w+') as apiout:
|
||||
apiout.write(apikey)
|
||||
apikey = apikey.strip()
|
||||
os.chmod('/etc/confluent/confluent.apikey', 0o600)
|
||||
return apikey
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user