1
0
Fork 0
mirror of https://github.com/sileht/bird-lg.git synced 2024-11-21 22:44:43 +01:00

Merge pull request #68 from gmarsay/optional-domain

DOMAIN is now optional
This commit is contained in:
zorun 2020-06-15 11:31:33 +02:00 committed by GitHub
commit 1e78b20860
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

14
lg.py
View file

@ -148,8 +148,14 @@ def bird_proxy(host, proto, service, query):
return False, 'Host "%s" invalid' % host
elif not path:
return False, 'Proto "%s" invalid' % proto
else:
url = "http://%s.%s:%d/%s?q=%s" % (host, app.config["DOMAIN"], port, path, quote(query))
url = "http://%s" % (host)
if "DOMAIN" in app.config:
url = "%s.%s" % (url, app.config["DOMAIN"])
url = "%s:%d/%s?" % (url, port, path)
url = "%sq=%s" % (url, quote(query))
try:
f = urlopen(url)
resultat = f.read()
@ -157,6 +163,7 @@ def bird_proxy(host, proto, service, query):
except IOError:
resultat = "Failed retreive url: %s" % url
status = False
return status, resultat
@ -459,7 +466,10 @@ def show_bgpmap():
return edges[edge_tuple]
for host, asmaps in data.iteritems():
if "DOMAIN" in app.config:
add_node(host, label= "%s\r%s" % (host.upper(), app.config["DOMAIN"].upper()), shape="box", fillcolor="#F5A9A9")
else:
add_node(host, label= "%s" % (host.upper()), shape="box", fillcolor="#F5A9A9")
as_number = app.config["AS_NUMBER"].get(host, None)
if as_number: