From c9e6a51dccaf901982696543aab5041581fab436 Mon Sep 17 00:00:00 2001 From: Narayan Desai Date: Thu, 18 Jan 2007 16:10:37 +0000 Subject: Fix bcfg2-admin for xincluded groups files. Document bcfg2-admin git-svn-id: https://svn.mcs.anl.gov/repos/bcfg/trunk/bcfg2@2692 ce84e21b-d406-0410-9b95-82705330c041 --- man/bcfg2-admin.8 | 37 +++++++++++++++++++++++++++++++++++++ src/sbin/bcfg2-admin | 20 ++++++++++++-------- 2 files changed, 49 insertions(+), 8 deletions(-) create mode 100644 man/bcfg2-admin.8 diff --git a/man/bcfg2-admin.8 b/man/bcfg2-admin.8 new file mode 100644 index 000000000..9918b1048 --- /dev/null +++ b/man/bcfg2-admin.8 @@ -0,0 +1,37 @@ +.TH "bcfg2-admin" 8 +.SH NAME +bcfg2-admin \- Perform repository administration tasks +.SH SYNOPSIS +.B bcfg2-server +.I init +.I mineentry +.I minestruct +.I viz [-h] [-b] [-k] [-o output.png] [-r] + +.SH DESCRIPTION +.PP +.B bcfg2-server +This daemon serves configurations to clients based on the data in its +repository. +.SH VIZ OPTIONS +.PP +.B \-h +.RS +Include hosts in diagram +.RE +.B \-b +.RS +Include bundles in diagram +.RE +.B "-o " +.RS +Write to outfile file instead of stdout +.RE +.B \-r +.RS +Produce raw graphviz output +.RE +.B \-k +.RS +Add a shape/color key +.RE diff --git a/src/sbin/bcfg2-admin b/src/sbin/bcfg2-admin index 011bf8688..d100b936c 100755 --- a/src/sbin/bcfg2-admin +++ b/src/sbin/bcfg2-admin @@ -14,7 +14,7 @@ bcfg2-admin [options] init - initialize the bcfg2 repository( this is interactive; only run once ) mineentry - mine statistics for entry information minestruct - mine statistics for extra entries -viz [-h] [-b] [-m] [-o output.png] [-r] +viz [-h] [-b] [-k] [-o output.png] [-r] ''' config = ''' @@ -268,19 +268,22 @@ def do_tidy(args): def do_viz(args): '''Build visualization of groups file''' - if '-C' in args: + if '-R' in args: + repo = args[args.index('-R') + 1] + elif '-C' in args: repo = get_repo_path(args[args.index('-C') + 1]) else: repo = get_repo_path() - groups = lxml.etree.parse(repo + '/Metadata/groups.xml').getroot() - clients = lxml.etree.parse(repo + '/Metadata/clients.xml').getroot() + groupdata = lxml.etree.parse(repo + '/Metadata/groups.xml') + groupdata.xinclude() + groups = groupdata.getroot() if '-r' in args: dotpipe = popen2.Popen4("dd bs=4M 2>/dev/null") else: dotpipe = popen2.Popen4("dot -Tpng") categories = {'default':'grey83'} instances = {} - for group in groups.findall('Group'): + for group in groups.findall('.//Groups/Group'): if group.get('category', False): if not categories.has_key(group.get('category')): categories[group.get('category')] = colors.pop() @@ -292,6 +295,7 @@ def do_viz(args): raise SystemExit, 1 dotpipe.tochild.write('\trankdir="LR";\n') if '-h' in args: + clients = lxml.etree.parse(repo + '/Metadata/clients.xml').getroot() for client in clients.findall('Client'): if instances.has_key(client.get('profile')): instances[client.get('profile')].append(client.get('name')) @@ -310,7 +314,7 @@ def do_viz(args): for bundle in bundles: dotpipe.tochild.write('''\t"bundle-%s" [ label="%s", shape="septagon"];\n''' % (bundle, bundle)) gseen = [] - for group in groups.findall('Group'): + for group in groups.findall('.//Groups/Group'): color = categories[group.get('category', 'default')] if group.get('profile', 'false') == 'true': style="filled, bold" @@ -324,7 +328,7 @@ def do_viz(args): dotpipe.tochild.write('\t"group-%s" -> "bundle-%s";\n' % (group.get('name'), bundle.get('name'))) - for group in groups.findall('Group'): + for group in groups.findall('.//Groups/Group'): for parent in group.findall('Group'): if parent.get('name') not in gseen: dotpipe.tochild.write('\t"group-%s" [label="%s", style="filled", fillcolor="grey83"];\n' % @@ -332,7 +336,7 @@ def do_viz(args): gseen.append(parent.get("name")) dotpipe.tochild.write('\t"group-%s" -> "group-%s" ;\n' % (group.get('name'), parent.get('name'))) - if '-m' not in args: + if '-k' not in args: dotpipe.tochild.write("\tsubgraph cluster_key {\n") dotpipe.tochild.write('''\tstyle="filled";\n''') dotpipe.tochild.write('''\tcolor="lightblue";\n''') -- cgit v1.2.3-1-g7c22