summaryrefslogtreecommitdiffstats
path: root/src
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 /src
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
Diffstat (limited to 'src')
-rwxr-xr-xsrc/sbin/bcfg2-admin20
1 files changed, 12 insertions, 8 deletions
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''')