mirror of
https://github.com/xcat2/confluent.git
synced 2024-11-22 01:22:00 +00:00
Fix apiclient with TPM managed token
The retry mechanism is amended to clear out the useless key and start trying to get a network grant again.
This commit is contained in:
parent
2ef695324a
commit
42f8056d56
@ -20,7 +20,10 @@ def get_apikey(nodename, mgr):
|
||||
if apikey:
|
||||
return apikey
|
||||
while not apikey:
|
||||
apikey = subprocess.check_output(['/opt/confluent/bin/clortho', nodename, mgr])
|
||||
try:
|
||||
apikey = subprocess.check_output(['/opt/confluent/bin/clortho', nodename, mgr])
|
||||
except subprocess.CalledProcessError:
|
||||
apikey = ''
|
||||
if not isinstance(apikey, str):
|
||||
apikey = apikey.decode('utf8')
|
||||
if apikey.startswith('SEALED:'):
|
||||
@ -116,6 +119,8 @@ class HTTPSClient(client.HTTPConnection, object):
|
||||
if rsp.status == 401:
|
||||
authed = False
|
||||
rsp.read()
|
||||
with open('/etc/confluent/confluent.apikey', 'w+') as akfile:
|
||||
akfile.write()
|
||||
self.stdheaders['CONFLUENT_APIKEY'] = get_apikey(
|
||||
self.node, self.host)
|
||||
raise Exception(rsp.read())
|
||||
|
Loading…
Reference in New Issue
Block a user