]> review.fuel-infra Code Review - openstack-build/cinder-build.git/commitdiff
Fix cinder-manage shell ipython
authorgtt116 <gtt116@gmail.com>
Thu, 22 Jan 2015 05:59:48 +0000 (05:59 +0000)
committergtt116 <gtt116@gmail.com>
Thu, 22 Jan 2015 05:59:48 +0000 (05:59 +0000)
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

index 8dabde5ba6335e7d130fae003973bc30f8ccc0a6..e11ffd3645c5147a18d8bd6c26f4c054018503f7 100644 (file)
@@ -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