mirror of
https://github.com/sileht/bird-lg.git
synced 2024-11-21 22:44:43 +01:00
DOMAIN is now optional
This commit is contained in:
parent
6f277c23cb
commit
d3e9d5c6b9
32
lg.py
32
lg.py
|
@ -148,16 +148,23 @@ def bird_proxy(host, proto, service, query):
|
||||||
return False, 'Host "%s" invalid' % host
|
return False, 'Host "%s" invalid' % host
|
||||||
elif not path:
|
elif not path:
|
||||||
return False, 'Proto "%s" invalid' % proto
|
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)
|
||||||
try:
|
if "DOMAIN" in app.config:
|
||||||
f = urlopen(url)
|
url = "%s.%s" % (url, app.config["DOMAIN"])
|
||||||
resultat = f.read()
|
url = "%s:%d/%s?" % (url, port, path)
|
||||||
status = True # retreive remote status
|
|
||||||
except IOError:
|
url = "%sq=%s" % (url, quote(query))
|
||||||
resultat = "Failed retreive url: %s" % url
|
|
||||||
status = False
|
try:
|
||||||
return status, resultat
|
f = urlopen(url)
|
||||||
|
resultat = f.read()
|
||||||
|
status = True # retreive remote status
|
||||||
|
except IOError:
|
||||||
|
resultat = "Failed retreive url: %s" % url
|
||||||
|
status = False
|
||||||
|
|
||||||
|
return status, resultat
|
||||||
|
|
||||||
|
|
||||||
@app.context_processor
|
@app.context_processor
|
||||||
|
@ -459,7 +466,10 @@ def show_bgpmap():
|
||||||
return edges[edge_tuple]
|
return edges[edge_tuple]
|
||||||
|
|
||||||
for host, asmaps in data.iteritems():
|
for host, asmaps in data.iteritems():
|
||||||
add_node(host, label= "%s\r%s" % (host.upper(), app.config["DOMAIN"].upper()), shape="box", fillcolor="#F5A9A9")
|
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)
|
as_number = app.config["AS_NUMBER"].get(host, None)
|
||||||
if as_number:
|
if as_number:
|
||||||
|
|
Loading…
Reference in a new issue