summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--doc/getting_started/using-bcfg2-info.txt15
-rwxr-xr-xsrc/sbin/bcfg2-info7
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, _):
"""