diff options
author | Narayan Desai <desai@mcs.anl.gov> | 2009-07-07 16:05:04 +0000 |
---|---|---|
committer | Narayan Desai <desai@mcs.anl.gov> | 2009-07-07 16:05:04 +0000 |
commit | 476cb9ac769b3cb43f7da80933d6ea6126aed1dc (patch) | |
tree | d3050eaf797914e896f9b9dc29ac5d56bcccd52e /src/lib | |
parent | 7452e1f8437976241b26adb0a45a9d5e734f82da (diff) | |
download | bcfg2-476cb9ac769b3cb43f7da80933d6ea6126aed1dc.tar.gz bcfg2-476cb9ac769b3cb43f7da80933d6ea6126aed1dc.tar.bz2 bcfg2-476cb9ac769b3cb43f7da80933d6ea6126aed1dc.zip |
bcfg2-admin viz: Implement support for arbitrary output types
bcfg2-admin viz now takes the output filename into consideration when choosing the output file type.
git-svn-id: https://svn.mcs.anl.gov/repos/bcfg/trunk/bcfg2@5310 ce84e21b-d406-0410-9b95-82705330c041
Diffstat (limited to 'src/lib')
-rw-r--r-- | src/lib/Server/Admin/Viz.py | 26 |
1 files changed, 12 insertions, 14 deletions
diff --git a/src/lib/Server/Admin/Viz.py b/src/lib/Server/Admin/Viz.py index ca8eee773..3451c56ae 100644 --- a/src/lib/Server/Admin/Viz.py +++ b/src/lib/Server/Admin/Viz.py @@ -33,8 +33,8 @@ class Viz(Bcfg2.Server.Admin.MetadataCore): Bcfg2.Server.Admin.MetadataCore.__call__(self, args) # First get options to the 'viz' subcommand try: - opts, args = getopt.getopt(args, 'rHbko:', - ['raw', 'includehosts', 'includebundles', + opts, args = getopt.getopt(args, 'Hbko:', + ['includehosts', 'includebundles', 'includekey', 'outfile=']) except getopt.GetoptError, msg: print msg @@ -46,9 +46,7 @@ class Viz(Bcfg2.Server.Admin.MetadataCore): kset = False outputfile = False for opt, arg in opts: - if opt in ("-r", "--raw"): - rset = True - elif opt in ("-H", "--includehosts"): + if opt in ("-H", "--includehosts"): hset = True elif opt in ("-b", "--includebundles"): bset = True @@ -57,21 +55,21 @@ class Viz(Bcfg2.Server.Admin.MetadataCore): elif opt in ("-o", "--outfile"): outputfile = arg - data = self.Visualize(self.get_repo_path(), rset, hset, bset, + data = self.Visualize(self.get_repo_path(), hset, bset, kset, outputfile) print data - def Visualize(self, repopath, raw=False, hosts=False, + def Visualize(self, repopath, hosts=False, bundles=False, key=False, output=False): '''Build visualization of groups file''' - if raw: - cmd = "dd bs=4M" - if output: - cmd += " of=%s" % output + if output: + format = output.split('.')[-1] else: - cmd = "dot -Tpng" - if output: - cmd += " -o %s" % output + format = 'png' + + cmd = "dot -T%s" % (format) + if output: + cmd += " -o %s" % output dotpipe = Popen(cmd, shell=True, stdin=PIPE, stdout=PIPE, close_fds=True) try: |