From 54fde4af21d0f9f152a5963f9c53edfaaabb950c Mon Sep 17 00:00:00 2001 From: Jarrod Johnson Date: Tue, 3 Aug 2021 16:44:03 -0400 Subject: [PATCH] Fix pessimistic error on apikey Actually make sure that the apikey retrieval failed before erroring. --- confluent_osdeploy/common/opt/confluent/bin/apiclient | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/confluent_osdeploy/common/opt/confluent/bin/apiclient b/confluent_osdeploy/common/opt/confluent/bin/apiclient index d4d6e625..6bd6a02a 100644 --- a/confluent_osdeploy/common/opt/confluent/bin/apiclient +++ b/confluent_osdeploy/common/opt/confluent/bin/apiclient @@ -28,9 +28,10 @@ def get_apikey(nodename, mgr): apikey = apikey.decode('utf8') if apikey.startswith('SEALED:'): apikey = "" - sys.stderr.write( - "Failed getting API token, check deployment.apiarmed attribute on {}\n".format(nodename)) - time.sleep(10) + if not apikey: + sys.stderr.write( + "Failed getting API token, check deployment.apiarmed attribute on {}\n".format(nodename)) + time.sleep(10) with open('/etc/confluent/confluent.apikey', 'w+') as apiout: apiout.write(apikey) apikey = apikey.strip()