diff options
author | Josh Blum | 2013-06-15 13:45:16 -0700 |
---|---|---|
committer | Josh Blum | 2013-06-15 13:45:16 -0700 |
commit | ecd4f779750093ea361ff0860e031917285f775c (patch) | |
tree | fca74004b028029ffb8c56f54d16277c757a7c34 /query | |
parent | 02256e17cc5b9b585340c7ae9a8c97943f5507df (diff) | |
download | sandhi-ecd4f779750093ea361ff0860e031917285f775c.tar.gz sandhi-ecd4f779750093ea361ff0860e031917285f775c.tar.bz2 sandhi-ecd4f779750093ea361ff0860e031917285f775c.zip |
gras: misc tweaks to dot related stuff
Diffstat (limited to 'query')
-rw-r--r-- | query/__init__.py | 8 |
1 files changed, 5 insertions, 3 deletions
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 |