From f5e35bfbced1f4109b2d03b96f035b4a3fe7ccc9 Mon Sep 17 00:00:00 2001 From: gtt116 Date: Thu, 22 Jan 2015 05:59:48 +0000 Subject: [PATCH] Fix cinder-manage shell ipython IPython current stable version is 2.3.1, and the code in cinder-manage is only work for IPython < 0.11. The patch make it work for IPython 2.3.1. Change-Id: I1555744fbf80771455ebd9f9095e8f9ddc7d16e7 Closes-Bug: #1413485 --- cinder/cmd/manage.py | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/cinder/cmd/manage.py b/cinder/cmd/manage.py index 8dabde5ba..e11ffd364 100644 --- a/cinder/cmd/manage.py +++ b/cinder/cmd/manage.py @@ -147,13 +147,20 @@ class ShellCommands(object): shell = 'ipython' if shell == 'ipython': try: - import IPython - # Explicitly pass an empty list as arguments, because - # otherwise IPython would use sys.argv from this script. - shell = IPython.Shell.IPShell(argv=[]) - shell.mainloop() + from IPython import embed + embed() except ImportError: - shell = 'python' + try: + # Ipython < 0.11 + # Explicitly pass an empty list as arguments, because + # otherwise IPython would use sys.argv from this script. + import IPython + + shell = IPython.Shell.IPShell(argv=[]) + shell.mainloop() + except ImportError: + # no IPython module + shell = 'python' if shell == 'python': import code -- 2.45.2