mirror of
https://github.com/sileht/bird-lg.git
synced 2024-11-22 06:54:43 +01:00
Temporary fix for error message detection
This commit is contained in:
parent
3bddf7ccee
commit
4b7831fa7c
8
lg.py
8
lg.py
|
@ -110,7 +110,7 @@ def summary(hosts, proto="ipv4"):
|
||||||
for host in hosts.split("+"):
|
for host in hosts.split("+"):
|
||||||
ret, res = bird_command(host, proto, command)
|
ret, res = bird_command(host, proto, command)
|
||||||
res = res.split("\n")
|
res = res.split("\n")
|
||||||
if ret:
|
if len(res) > 1: #if ret:
|
||||||
data = []
|
data = []
|
||||||
for line in res[1:]:
|
for line in res[1:]:
|
||||||
line = line.strip()
|
line = line.strip()
|
||||||
|
@ -123,7 +123,7 @@ def summary(hosts, proto="ipv4"):
|
||||||
|
|
||||||
summary[host] = data
|
summary[host] = data
|
||||||
else:
|
else:
|
||||||
summary[host] = { "error" : res }
|
summary[host] = { "error" : "\n".join(res) }
|
||||||
|
|
||||||
return render_template('summary.html', summary=summary, command=command)
|
return render_template('summary.html', summary=summary, command=command)
|
||||||
|
|
||||||
|
@ -137,7 +137,7 @@ def detail(hosts, proto):
|
||||||
for host in hosts.split("+"):
|
for host in hosts.split("+"):
|
||||||
ret, res = bird_command(host, proto, command)
|
ret, res = bird_command(host, proto, command)
|
||||||
res = res.split("\n")
|
res = res.split("\n")
|
||||||
if ret:
|
if len(res) > 1 : #if ret:
|
||||||
detail[host] = { "status": res[1], "description": add_links(res[2:]) }
|
detail[host] = { "status": res[1], "description": add_links(res[2:]) }
|
||||||
else:
|
else:
|
||||||
detail[host] = { "status": "bird error: %s" % "\n".join(res), "description": "" }
|
detail[host] = { "status": "bird error: %s" % "\n".join(res), "description": "" }
|
||||||
|
@ -203,7 +203,7 @@ def show_route(req_type, hosts, proto):
|
||||||
ret, res = bird_command(host, proto, command)
|
ret, res = bird_command(host, proto, command)
|
||||||
|
|
||||||
res = res.split("\n")
|
res = res.split("\n")
|
||||||
if ret:
|
if len(res) > 1 : #if ret:
|
||||||
detail[host] = add_links(res)
|
detail[host] = add_links(res)
|
||||||
else:
|
else:
|
||||||
detail[host] = "bird error: %s" % "\n".join(res)
|
detail[host] = "bird error: %s" % "\n".join(res)
|
||||||
|
|
Loading…
Reference in a new issue