From ecd4f779750093ea361ff0860e031917285f775c Mon Sep 17 00:00:00 2001 From: Josh Blum Date: Sat, 15 Jun 2013 13:45:16 -0700 Subject: gras: misc tweaks to dot related stuff --- query/__init__.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'query') diff --git a/query/__init__.py b/query/__init__.py index cca8354..403e68c 100644 --- a/query/__init__.py +++ b/query/__init__.py @@ -26,14 +26,16 @@ class MyHandler(BaseHTTPServer.BaseHTTPRequestHandler): args = server_registry[s.server] path = o.path + #generate the topology png if path == "/topology.png": s.send_response(200) s.send_header("Content-type", "image/png") s.end_headers() - dot = args['top_block'].query(json.dumps(dict(path='/topology.dot'))) + dot_markup = args['top_block'].query(json.dumps(dict(path='/topology.dot'))) import subprocess - p = subprocess.Popen(args=["dot", "-T", "png"], stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.PIPE) - (stdout, stderr) = p.communicate(input=dot) + dot_exe = os.environ.get("DOT_EXECUTABLE", "dot") + p = subprocess.Popen(args=[dot_exe, "-T", "png"], stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.PIPE) + (stdout, stderr) = p.communicate(input=dot_markup) s.wfile.write(stdout) return -- cgit