summaryrefslogtreecommitdiffstats
path: root/src/sbin/Bcfg2debug
diff options
context:
space:
mode:
authorNarayan Desai <desai@mcs.anl.gov>2005-01-31 05:06:56 +0000
committerNarayan Desai <desai@mcs.anl.gov>2005-01-31 05:06:56 +0000
commitdbf7f548f77804283ac1bc94f22f0d41c85cca7e (patch)
tree21a8db17f48e7cf61525fb55577e7666b6833729 /src/sbin/Bcfg2debug
parentaa7151509bc66276292dea95200fda42688e85b3 (diff)
downloadbcfg2-dbf7f548f77804283ac1bc94f22f0d41c85cca7e.tar.gz
bcfg2-dbf7f548f77804283ac1bc94f22f0d41c85cca7e.tar.bz2
bcfg2-dbf7f548f77804283ac1bc94f22f0d41c85cca7e.zip
update doc
2005/01/30 23:05:27-06:00 anl.gov!desai add a few more functions 2005/01/30 22:52:50-06:00 anl.gov!desai add more useful features (Logical change 1.197) git-svn-id: https://svn.mcs.anl.gov/repos/bcfg/trunk/bcfg2@842 ce84e21b-d406-0410-9b95-82705330c041
Diffstat (limited to 'src/sbin/Bcfg2debug')
-rw-r--r--src/sbin/Bcfg2debug35
1 files changed, 30 insertions, 5 deletions
diff --git a/src/sbin/Bcfg2debug b/src/sbin/Bcfg2debug
index 1b9664527..9a4a7e342 100644
--- a/src/sbin/Bcfg2debug
+++ b/src/sbin/Bcfg2debug
@@ -1,25 +1,50 @@
#!/usr/bin/env python
+__revision__ = '$Revision$'
+'''This tool loads the Bcfg2 core into an interactive debugger'''
+
from time import sleep
from Bcfg2.Server.Core import Core
def input():
try:
- return raw_input('> ')
+ return raw_input('> ').split(" ")
except:
- return ''
+ return ['']
if __name__ == '__main__':
+ settings = {}
core = Core('/etc/bcfg2.conf')
while core.fam.fm.pending():
while core.fam.fm.pending():
core.fam.HandleEvent()
sleep(0.5)
cmd = input()
- while cmd != '':
- if cmd == 'generators':
+ while cmd != ['']:
+ if cmd[0] in ['exit', 'quit']:
+ raise SystemExit, 0
+ elif cmd[0] == 'generators':
for generator in core.generators:
print generator.__version__
+ elif cmd[0] == 'help':
+ print 'Commands:'
+ print 'exit - quit'
+ print 'generators - list current versions of generators'
+ print 'help - print this text'
+ print 'set <variable> <value> - set variable for later use'
+ print 'settings - display all settings'
+ print 'shell - shell out to native python interpreter'
+ print 'version - print version of this tool'
+ elif cmd[0] == 'set':
+ settings[cmd[1]] = cmd[2]
+ elif cmd[0] == 'settings':
+ for (key, value) in settings.iteritems():
+ print "%s --> %s" % (key, value)
+ elif cmd[0] == 'shell':
+ cmd = ''
+ continue
+ elif cmd[0] == 'version':
+ print 'Bcfg2debug v. %s' % __revision__
else:
- print "Unimplemented command %s" % cmd
+ print "Unknown command %s" % cmd[0]
cmd = input()