2
0
mirror of https://github.com/xcat2/confluent.git synced 2024-12-25 04:32:11 +00:00

Have apiclient use first rather than last

apiclient was preferring the slowest rather than
the fastest respondant, inconsistent with intent
and everything else.
This commit is contained in:
Jarrod Johnson 2020-06-19 07:29:14 -04:00
parent 5bc9cb57d1
commit e7b93dba50
2 changed files with 4 additions and 2 deletions

View File

@ -8,11 +8,12 @@ class HTTPSClient(client.HTTPConnection, object):
def __init__(self, port=443):
self.stdheaders = {}
info = open('/etc/confluent/confluent.info').read().split('\n')
host = None
for line in info:
if line.startswith('NODENAME:'):
node = line.split(' ')[1]
self.stdheaders['CONFLUENT_NODENAME'] = node
if line.startswith('MANAGER:'):
if line.startswith('MANAGER:') and not host:
host = line.split(' ')[1]
self.stdheaders['CONFLUENT_APIKEY'] = open('/etc/confluent/confluent.apikey').read().strip()
client.HTTPConnection.__init__(self, host, port)

View File

@ -8,11 +8,12 @@ class HTTPSClient(client.HTTPConnection, object):
def __init__(self, port=443):
self.stdheaders = {}
info = open('/etc/confluent/confluent.info').read().split('\n')
host = None
for line in info:
if line.startswith('NODENAME:'):
node = line.split(' ')[1]
self.stdheaders['CONFLUENT_NODENAME'] = node
if line.startswith('MANAGER:'):
if line.startswith('MANAGER:') and not host:
host = line.split(' ')[1]
self.stdheaders['CONFLUENT_APIKEY'] = open('/etc/confluent/confluent.apikey').read().strip()
client.HTTPConnection.__init__(self, host, port)