From 004e609635bc64b651279c326487bd2f8a33ef71 Mon Sep 17 00:00:00 2001 From: Jarrod Johnson Date: Wed, 1 Jul 2020 11:29:31 -0400 Subject: [PATCH] Fix apikey strip for python2 Strip after any conversions, whether it is bytes or str. --- confluent_osdeploy/common/opt/confluent/bin/apiclient | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/confluent_osdeploy/common/opt/confluent/bin/apiclient b/confluent_osdeploy/common/opt/confluent/bin/apiclient index 45586c6d..19f4fa91 100644 --- a/confluent_osdeploy/common/opt/confluent/bin/apiclient +++ b/confluent_osdeploy/common/opt/confluent/bin/apiclient @@ -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