Commit e0917607 authored by Tom Niget's avatar Tom Niget

Handle errors in topology

parent 789df211
......@@ -499,11 +499,12 @@ if args.port:
if page < 2:
body = route_svg(page)
else:
body = registry.Popen(('python3', '-c', r"""if 1:
import math, json
out, err = registry.Popen(('python3', '-c', r"""if 1:
import math, json, sys
from re6st.registry import RegistryClient
g = json.loads(RegistryClient(
'http://localhost/').topology())
topo = RegistryClient('http://localhost/').topology()
g = json.loads(topo)
assert g, 'Topology is empty'
r = set(g.pop('', ()))
a = set()
for v in g.values():
......@@ -522,7 +523,11 @@ if args.port:
for v in v:
print('"%s" -> "%s";' % (n, title(v)))
print('}')
"""), stdout=subprocess.PIPE, cwd="..").communicate()[0].decode("utf-8")
"""), stdout=subprocess.PIPE, stderr=subprocess.PIPE, cwd="..").communicate()
if err:
self.send_error(500, explain=err.decode("utf-8"))
return
body = out.decode("utf-8")
if body:
body = subprocess.Popen(('neato', '-Tsvg'),
stdin=subprocess.PIPE, stdout=subprocess.PIPE,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment