summaryrefslogtreecommitdiffstats
path: root/src/lib/Server/Admin/Viz.py
diff options
context:
space:
mode:
authorSol Jerome <solj@ices.utexas.edu>2009-02-20 21:56:47 +0000
committerSol Jerome <solj@ices.utexas.edu>2009-02-20 21:56:47 +0000
commitabc364013de96b1ff0170b65665388ed8ca3e07f (patch)
tree04e1b5c369edc905fea4e785cbbadc207a670571 /src/lib/Server/Admin/Viz.py
parent202a3aec707802a85bbf5bfbf82e86a0317c2bbb (diff)
downloadbcfg2-abc364013de96b1ff0170b65665388ed8ca3e07f.tar.gz
bcfg2-abc364013de96b1ff0170b65665388ed8ca3e07f.tar.bz2
bcfg2-abc364013de96b1ff0170b65665388ed8ca3e07f.zip
os.popen is deprecated in 2.6 (http://docs.python.org/library/os.html#os.popen)
Signed-off-by: Sol Jerome <solj@ices.utexas.edu> git-svn-id: https://svn.mcs.anl.gov/repos/bcfg/trunk/bcfg2@5088 ce84e21b-d406-0410-9b95-82705330c041
Diffstat (limited to 'src/lib/Server/Admin/Viz.py')
-rw-r--r--src/lib/Server/Admin/Viz.py36
1 files changed, 19 insertions, 17 deletions
diff --git a/src/lib/Server/Admin/Viz.py b/src/lib/Server/Admin/Viz.py
index 0a5a8b9d6..f973e90c5 100644
--- a/src/lib/Server/Admin/Viz.py
+++ b/src/lib/Server/Admin/Viz.py
@@ -1,4 +1,5 @@
-import getopt, popen2
+import getopt
+from subprocess import Popen, PIPE
import Bcfg2.Server.Admin
class Viz(Bcfg2.Server.Admin.MetadataCore):
@@ -71,25 +72,26 @@ class Viz(Bcfg2.Server.Admin.MetadataCore):
cmd = "dot -Tpng"
if output:
cmd += " -o %s" % output
- dotpipe = popen2.Popen4(cmd)
+ dotpipe = subprocess.Popen(cmd, shell=True, stdin=subprocess.PIPE,
+ stdout=subprocess.PIPE, close_fds=True)
try:
- dotpipe.tochild.write("digraph groups {\n")
+ dotpipe.stdin.write("digraph groups {\n")
except:
print "write to dot process failed. Is graphviz installed?"
raise SystemExit(1)
- dotpipe.tochild.write('\trankdir="LR";\n')
- dotpipe.tochild.write(self.metadata.viz(hosts, bundles,
+ dotpipe.stdin.write('\trankdir="LR";\n')
+ dotpipe.stdin.write(self.metadata.viz(hosts, bundles,
key, self.colors))
if key:
- dotpipe.tochild.write("\tsubgraph cluster_key {\n")
- dotpipe.tochild.write('''\tstyle="filled";\n''')
- dotpipe.tochild.write('''\tcolor="lightblue";\n''')
- dotpipe.tochild.write('''\tBundle [ shape="septagon" ];\n''')
- dotpipe.tochild.write('''\tGroup [shape="ellipse"];\n''')
- dotpipe.tochild.write('''\tProfile [style="bold", shape="ellipse"];\n''')
- dotpipe.tochild.write('''\tHblock [label="Host1|Host2|Host3", shape="record"];\n''')
- dotpipe.tochild.write('''\tlabel="Key";\n''')
- dotpipe.tochild.write("\t}\n")
- dotpipe.tochild.write("}\n")
- dotpipe.tochild.close()
- return dotpipe.fromchild.read()
+ dotpipe.stdin.write("\tsubgraph cluster_key {\n")
+ dotpipe.stdin.write('''\tstyle="filled";\n''')
+ dotpipe.stdin.write('''\tcolor="lightblue";\n''')
+ dotpipe.stdin.write('''\tBundle [ shape="septagon" ];\n''')
+ dotpipe.stdin.write('''\tGroup [shape="ellipse"];\n''')
+ dotpipe.stdin.write('''\tProfile [style="bold", shape="ellipse"];\n''')
+ dotpipe.stdin.write('''\tHblock [label="Host1|Host2|Host3", shape="record"];\n''')
+ dotpipe.stdin.write('''\tlabel="Key";\n''')
+ dotpipe.stdin.write("\t}\n")
+ dotpipe.stdin.write("}\n")
+ dotpipe.stdin.close()
+ return dotpipe.stdout.read()