summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorNarayan Desai <desai@mcs.anl.gov>2007-10-30 02:34:18 +0000
committerNarayan Desai <desai@mcs.anl.gov>2007-10-30 02:34:18 +0000
commit23fcbe41f466bd4269a96f1730cbe4ae230a521f (patch)
tree520bb381bcceac51ea9e9913544171f7446b5227 /src
parent42a3be9cb383d0dc029a9ec6a8eacaf25cc7b2be (diff)
downloadbcfg2-23fcbe41f466bd4269a96f1730cbe4ae230a521f.tar.gz
bcfg2-23fcbe41f466bd4269a96f1730cbe4ae230a521f.tar.bz2
bcfg2-23fcbe41f466bd4269a96f1730cbe4ae230a521f.zip
Implement cmdlook resumption in bcfg2-info
git-svn-id: https://svn.mcs.anl.gov/repos/bcfg/trunk/bcfg2@3885 ce84e21b-d406-0410-9b95-82705330c041
Diffstat (limited to 'src')
-rwxr-xr-xsrc/sbin/bcfg2-info30
1 files changed, 18 insertions, 12 deletions
diff --git a/src/sbin/bcfg2-info b/src/sbin/bcfg2-info
index c74118f76..319831e53 100755
--- a/src/sbin/bcfg2-info
+++ b/src/sbin/bcfg2-info
@@ -6,6 +6,8 @@ import copy, logging, lxml.etree, sys, time, cmd
import Bcfg2.Logging, Bcfg2.Server.Core, os
import Bcfg2.Server.Plugins.Metadata, Bcfg2.Server.Plugin
+logger = logging.getLogger('bcfg2-info')
+
class dummyError(Exception):
pass
@@ -34,8 +36,23 @@ class infoCore(cmd.Cmd, Bcfg2.Server.Core.Core):
self.fam.Service()
time.sleep(0.5)
+ def do_loop(self):
+ self.cont = True
+ while self.cont:
+ try:
+ self.cmdloop()
+ except SystemExit, val:
+ raise
+ except Bcfg2.Server.Plugin.PluginExecutionError:
+ continue
+ except dummyError:
+ continue
+ except:
+ logger.error("command failure", exc_info=1)
+
def do_debug(self, _):
self.cont = False
+ print "dropping to python interpreter; run loop.do_loop() to resume"
raise dummyError
def do_quit(self, _):
@@ -241,7 +258,6 @@ Usage: [quit|exit]"""
if __name__ == '__main__':
Bcfg2.Logging.setup_logging('bcfg2-info', to_syslog=False)
- logger = logging.getLogger('bcfg2-info')
if '-C' in sys.argv:
cfile = sys.argv[-1]
else:
@@ -249,14 +265,4 @@ if __name__ == '__main__':
loop = infoCore(cfile)
loop.plugins['Metadata'].load_probedata()
- while loop.cont:
- try:
- loop.cmdloop()
- except SystemExit, val:
- raise
- except Bcfg2.Server.Plugin.PluginExecutionError:
- continue
- except dummyError:
- continue
- except:
- logger.error("command failure", exc_info=1)
+ loop.do_loop()