2
0
mirror of https://github.com/xcat2/confluent.git synced 2025-02-28 08:11:45 +00:00

Use the scan_confluent for getting apikey, if relevant

This commit is contained in:
Jarrod Johnson 2021-10-20 14:03:03 -04:00
parent 484a3f8c64
commit 8a01a0bbdc

View File

@ -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))