diff options
author | Sol Jerome <solj@ices.utexas.edu> | 2010-08-23 20:47:04 +0000 |
---|---|---|
committer | Sol Jerome <sol.jerome@gmail.com> | 2010-08-27 08:28:39 -0500 |
commit | d6b3084cbc96307c44ebfd734f88d2692a85c6c7 (patch) | |
tree | 588dcdc8c5963e95a13d9873fc6aadadc93ab241 | |
parent | b2f66ed8f6325fbe2d2b00887c250501e9e35128 (diff) | |
download | bcfg2-d6b3084cbc96307c44ebfd734f88d2692a85c6c7.tar.gz bcfg2-d6b3084cbc96307c44ebfd734f88d2692a85c6c7.tar.bz2 bcfg2-d6b3084cbc96307c44ebfd734f88d2692a85c6c7.zip |
bcfg2-info: Add IPython support (Patch from Jeff Strunk) for Ticket #921
Signed-off-by: Sol Jerome <sol.jerome@gmail.com>
git-svn-id: https://svn.mcs.anl.gov/repos/bcfg/trunk/bcfg2@6034 ce84e21b-d406-0410-9b95-82705330c041
-rw-r--r-- | doc/getting_started/using-bcfg2-info.txt | 15 | ||||
-rwxr-xr-x | src/sbin/bcfg2-info | 7 |
2 files changed, 15 insertions, 7 deletions
diff --git a/doc/getting_started/using-bcfg2-info.txt b/doc/getting_started/using-bcfg2-info.txt index dc5e3ea10..1fab0ea07 100644 --- a/doc/getting_started/using-bcfg2-info.txt +++ b/doc/getting_started/using-bcfg2-info.txt @@ -117,13 +117,16 @@ in *bcfg2-info* to aid in the process. performance problems in configuration generation. **debug** - The debug command exits the *bcfg2-info* interpreter loop and - drops to a python interpreter prompt. The Bcfg2 server core is - available in this namespace as "self". Full documentation for - the server core is out of scope for this document. This - capability is most useful to call into plugin methods, often with - setup calls or the enabling of diagnostics. + The debug command exits the *bcfg2-info* interpreter loop and drops + to a python interpreter prompt. The Bcfg2 server core is available + in this namespace as "self". Full documentation for the server core + is out of scope for this document. This capability is most useful + to call into plugin methods, often with setup calls or the enabling + of diagnostics. It is possible to return to the *bcfg2-info* command loop by exiting the python interpreter with ^D. + There is built-in support for IPython in *bcfg2-info*. If IPython + is installed, dropping into debug mode in *bcfg2-info* will use + the IPython interpreter by default. diff --git a/src/sbin/bcfg2-info b/src/sbin/bcfg2-info index fefeec79e..6732d8830 100755 --- a/src/sbin/bcfg2-info +++ b/src/sbin/bcfg2-info @@ -134,7 +134,12 @@ class infoCore(cmd.Cmd, Bcfg2.Server.Core.Core): sh.push(command) if interactive: print("dropping to python interpreter; press ^D to resume") - sh.interact() + try: + import IPython + shell = IPython.Shell.IPShell(argv=[], user_ns=locals()) + shell.mainloop() + except ImportError: + sh.interact() def do_quit(self, _): """ |