SUROK_GROUP env variable
This commit is contained in:
parent
c173a68f5e
commit
9120d723a2
@ -7,12 +7,17 @@ def resolve(app, conf):
|
|||||||
hosts = {}
|
hosts = {}
|
||||||
services = app['services']
|
services = app['services']
|
||||||
domain = conf['domain']
|
domain = conf['domain']
|
||||||
|
group = None
|
||||||
for service in services:
|
for service in services:
|
||||||
hosts[service['name']] = []
|
hosts[service['name']] = []
|
||||||
|
if app['env'].get('SUROK_GROUP') is not None:
|
||||||
|
group = app['env']['SUROK_GROUP']
|
||||||
|
else:
|
||||||
|
group = service['group']
|
||||||
try:
|
try:
|
||||||
for rdata in dns.resolver.query('_' +
|
for rdata in dns.resolver.query('_' +
|
||||||
service['name'] + '.' +
|
service['name'] + '.' +
|
||||||
service['group'] + '._tcp.' +
|
group + '._tcp.' +
|
||||||
domain, 'SRV'):
|
domain, 'SRV'):
|
||||||
info = str(rdata).split()
|
info = str(rdata).split()
|
||||||
server = {'name': info[3], 'port': info[2]}
|
server = {'name': info[3], 'port': info[2]}
|
||||||
@ -21,6 +26,6 @@ def resolve(app, conf):
|
|||||||
except Exception as e:
|
except Exception as e:
|
||||||
print(str(e) + ": Could not resolve " +
|
print(str(e) + ": Could not resolve " +
|
||||||
service['name'] + '.' +
|
service['name'] + '.' +
|
||||||
service['group'] + '._tcp.' + domain)
|
group + '._tcp.' + domain)
|
||||||
|
|
||||||
return hosts
|
return hosts
|
||||||
|
Loading…
Reference in New Issue
Block a user