From: gtt116 Date: Thu, 22 Jan 2015 05:59:48 +0000 (+0000) Subject: Fix cinder-manage shell ipython X-Git-Url: https://review.fuel-infra.org/gitweb?a=commitdiff_plain;h=f5e35bfbced1f4109b2d03b96f035b4a3fe7ccc9;p=openstack-build%2Fcinder-build.git 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 --- 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