diff options
Diffstat (limited to 'src/lib/Server')
-rw-r--r-- | src/lib/Server/Admin/Viz.py | 18 |
1 files changed, 14 insertions, 4 deletions
diff --git a/src/lib/Server/Admin/Viz.py b/src/lib/Server/Admin/Viz.py index fe6a8a7c2..2c618634a 100644 --- a/src/lib/Server/Admin/Viz.py +++ b/src/lib/Server/Admin/Viz.py @@ -87,11 +87,21 @@ class Viz(Bcfg2.Server.Admin.MetadataCore): else: format = 'png' - cmd = ["dot", "-T", pipes.quote(format)] + cmd = ["dot", "-T", format] if output: - cmd.extend(["-o", pipes.quote(output)]) - dotpipe = Popen(cmd, - shell=True, stdin=PIPE, stdout=PIPE, close_fds=True) + cmd.extend(["-o", output]) + try: + dotpipe = Popen(cmd, stdin=PIPE, stdout=PIPE, close_fds=True) + except OSError: + # on some systems (RHEL 6), you cannot run dot with + # shell=True. on others (Gentoo with Python 2.7), you + # must. In yet others (RHEL 5), either way works. I have + # no idea what the difference is, but it's kind of a PITA. + cmd = ["dot", "-T", pipes.quote(format)] + if output: + cmd.extend(["-o", pipes.quote(output)]) + dotpipe = Popen(cmd, shell=True, + stdin=PIPE, stdout=PIPE, close_fds=True) try: dotpipe.stdin.write("digraph groups {\n") except: |