From dbf7f548f77804283ac1bc94f22f0d41c85cca7e Mon Sep 17 00:00:00 2001 From: Narayan Desai Date: Mon, 31 Jan 2005 05:06:56 +0000 Subject: 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 --- src/sbin/Bcfg2debug | 35 ++++++++++++++++++++++++++++++----- 1 file changed, 30 insertions(+), 5 deletions(-) (limited to 'src') 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 - 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() -- cgit v1.2.3-1-g7c22