From 56f808951e8bd7850eb0da4a540a5fddb70f42c6 Mon Sep 17 00:00:00 2001 From: Difrex Date: Wed, 17 Aug 2016 16:50:56 +0300 Subject: [PATCH] multiports --- surok/discovery.py | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/surok/discovery.py b/surok/discovery.py index 6c1a6ad..310900c 100644 --- a/surok/discovery.py +++ b/surok/discovery.py @@ -28,21 +28,22 @@ def resolve(app, conf): group = service['group'] # Port name from app config - port_name = None + ports = None try: - port_name = service['port_name'] + ports = service['ports'] except: pass # This is fast fix for port naming # Will be rewrite later fqdn = '' - if port_name is not None: - fqdn = '_' + port_name + '.' + '_' + service['name'] + '.' + group + '._tcp.' + domain + if ports is not None: + for port_name in ports: + fqdn = '_' + port_name + '.' + '_' + service['name'] + '.' + group + '._tcp.' + domain + hosts[service['name']]['ports'][port_name] = do_query(fqdn, conf['loglevel']) else: fqdn = '_' + service['name'] + '.' + group + '._tcp.' + domain - - hosts[service['name']] = do_query(fqdn, conf['loglevel']) + hosts[service['name']] = do_query(fqdn, conf['loglevel']) return hosts