mirror of
https://github.com/xcat2/confluent.git
synced 2024-11-25 19:10:10 +00:00
Correct ipv4/v6 handling in get_apikey
This commit is contained in:
parent
cf097b153e
commit
7ba10e559e
@ -19,14 +19,18 @@ def get_apikey(nodename, mgr, mgr6):
|
||||
apikey = open('/etc/confluent/confluent.apikey').read().strip()
|
||||
if apikey:
|
||||
return apikey
|
||||
hosts = []
|
||||
for host in (mgr, mgr6):
|
||||
if not host:
|
||||
continue
|
||||
hosts.append(host)
|
||||
while not apikey:
|
||||
try:
|
||||
apikey = subprocess.check_output(['/opt/confluent/bin/clortho', nodename, mgr])
|
||||
except subprocess.CalledProcessError:
|
||||
for host in hosts:
|
||||
try:
|
||||
apikey = subprocess.check_output(['/opt/confluent/bin/clortho', nodename, mgr6])
|
||||
apikey = subprocess.check_output(['/opt/confluent/bin/clortho', nodename, host])
|
||||
except subprocess.CalledProcessError:
|
||||
apikey = ''
|
||||
continue
|
||||
break
|
||||
if not isinstance(apikey, str):
|
||||
apikey = apikey.decode('utf8')
|
||||
if apikey.startswith('SEALED:'):
|
||||
|
Loading…
Reference in New Issue
Block a user