summaryrefslogtreecommitdiff
path: root/query
diff options
context:
space:
mode:
authorJosh Blum2013-06-15 13:45:16 -0700
committerJosh Blum2013-06-15 13:45:16 -0700
commitecd4f779750093ea361ff0860e031917285f775c (patch)
treefca74004b028029ffb8c56f54d16277c757a7c34 /query
parent02256e17cc5b9b585340c7ae9a8c97943f5507df (diff)
downloadsandhi-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__.py8
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