summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorNarayan Desai <desai@mcs.anl.gov>2006-05-09 21:38:28 +0000
committerNarayan Desai <desai@mcs.anl.gov>2006-05-09 21:38:28 +0000
commit6c87661d4dc0f9cbaa09a16d713d1690e23d62c9 (patch)
treefa5598f09c50109a18bf922cd13aad811d91d52d /src
parent352ce14dd2c1579785dc4d274e7e1467c8f54a61 (diff)
downloadbcfg2-6c87661d4dc0f9cbaa09a16d713d1690e23d62c9.tar.gz
bcfg2-6c87661d4dc0f9cbaa09a16d713d1690e23d62c9.tar.bz2
bcfg2-6c87661d4dc0f9cbaa09a16d713d1690e23d62c9.zip
Implement the showentries command (from Cory)
git-svn-id: https://svn.mcs.anl.gov/repos/bcfg/trunk/bcfg2@1861 ce84e21b-d406-0410-9b95-82705330c041
Diffstat (limited to 'src')
-rwxr-xr-xsrc/sbin/bcfg2-info25
1 files changed, 24 insertions, 1 deletions
diff --git a/src/sbin/bcfg2-info b/src/sbin/bcfg2-info
index 9ad7972e2..a7ff04a92 100755
--- a/src/sbin/bcfg2-info
+++ b/src/sbin/bcfg2-info
@@ -20,6 +20,28 @@ def getInput():
return raw_input('> ').split(" ")
except KeyboardInterrupt:
return ['']
+def doShowentries(cmd, core):
+ '''show abstract configuration entries for a given host'''
+ if len(cmd) not in [2, 3]:
+ print "Usage: showentries <hostname> <type>"
+ return
+ try:
+ meta = core.metadata.get_metadata(cmd[1])
+ except:
+ print "Unable to find metadata for host %s" % cmd[1]
+ return
+ structures = core.GetStructures(meta)
+ output = [('entrytype', 'name')]
+ if len(cmd) == 2:
+ for item in structures:
+ for child in item.getchildren():
+ output.append((child.tag, child.get('name')))
+ if len(cmd) == 3:
+ for item in structures:
+ for child in item.getchildren():
+ if child.tag == cmd[2]:
+ output.append((child.tag, child.get('name')))
+ printTabular(output)
def doBuild(cmd, core):
'''build client configuration'''
@@ -71,6 +93,7 @@ def doHelp(_, dummy):
print 'help - print this text'
print 'mappings <type*> <name*>- print generator mappings for optional type and name'
print 'quit'
+ print 'showentries <hostname> <type> - show abstract configuration entries for a given host'
print 'update - process pending file events'
print 'version - print version of this tool'
@@ -139,7 +162,7 @@ if __name__ == '__main__':
dispatch = {'build': doBuild, 'buildfile': doBuildFile, 'bundles': doBundles,
'clients': doClients, 'generators': doGenerators, 'groups': doGroups,
'help': doHelp, 'mappings': doMappings, 'quit': doQuit,
- 'update': doUpdate, 'version': doVersion}
+ 'showentries': doShowentries, 'update': doUpdate, 'version': doVersion}
if '-c' in sys.argv:
cfile = sys.argv[-1]
else: