summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNarayan Desai <desai@mcs.anl.gov>2007-01-18 16:10:37 +0000
committerNarayan Desai <desai@mcs.anl.gov>2007-01-18 16:10:37 +0000
commitc9e6a51dccaf901982696543aab5041581fab436 (patch)
treebdb9a5eb87dc606f43636d92c357dd8b56aca15a
parent807ca1c7237149a66cd26fb91500f9dd98e6cbb6 (diff)
downloadbcfg2-c9e6a51dccaf901982696543aab5041581fab436.tar.gz
bcfg2-c9e6a51dccaf901982696543aab5041581fab436.tar.bz2
bcfg2-c9e6a51dccaf901982696543aab5041581fab436.zip
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
-rw-r--r--man/bcfg2-admin.837
-rwxr-xr-xsrc/sbin/bcfg2-admin20
2 files changed, 49 insertions, 8 deletions
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 <client> <entry type> <entry name>
+.I minestruct <client>
+.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 <output file>"
+.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 <client> <entry type> <entry name> - mine statistics for entry information
minestruct <client> - 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''')