From 8a01a0bbdceef3587a7e2cc5fe273ae31bb9ba08 Mon Sep 17 00:00:00 2001 From: Jarrod Johnson Date: Wed, 20 Oct 2021 14:03:03 -0400 Subject: [PATCH] Use the scan_confluent for getting apikey, if relevant --- .../common/opt/confluent/bin/apiclient | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/confluent_osdeploy/common/opt/confluent/bin/apiclient b/confluent_osdeploy/common/opt/confluent/bin/apiclient index 5ee45de8..7cdda737 100644 --- a/confluent_osdeploy/common/opt/confluent/bin/apiclient +++ b/confluent_osdeploy/common/opt/confluent/bin/apiclient @@ -175,9 +175,21 @@ def get_apikey(nodename, mgr, mgr6=None): hosts.append(host) while not apikey: for host in hosts: - apikey = get_net_apikey(nodename, host) + try: + apikey = get_net_apikey(nodename, host) + except OSError: + apikey = None if apikey: break + else: + srvlist, _ = scan_confluents() + for host in srvlist: + try: + apikey = get_net_apikey(nodename, host) + except OSError: + apikey = None + if apikey: + break if not apikey: sys.stderr.write( "Failed getting API token, check deployment.apiarmed attribute on {}\n".format(nodename))