summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--glanceclient/shell.py2
-rw-r--r--glanceclient/tests/unit/test_shell.py8
-rw-r--r--releasenotes/notes/fix-undesirable-raw-python-error-66e3ddaca7b72ae2.yaml7
3 files changed, 17 insertions, 0 deletions
diff --git a/glanceclient/shell.py b/glanceclient/shell.py
index ca10359..3a32bfb 100644
--- a/glanceclient/shell.py
+++ b/glanceclient/shell.py
@@ -166,6 +166,8 @@ class OpenStackImagesShell(object):
parser.add_argument('--os_image_api_version',
help=argparse.SUPPRESS)
+ parser.set_defaults(func=self.do_help)
+
if osprofiler_profiler:
parser.add_argument('--profile',
metavar='HMAC_KEY',
diff --git a/glanceclient/tests/unit/test_shell.py b/glanceclient/tests/unit/test_shell.py
index 74d1c33..129b127 100644
--- a/glanceclient/tests/unit/test_shell.py
+++ b/glanceclient/tests/unit/test_shell.py
@@ -211,6 +211,14 @@ class ShellTest(testutils.TestCase):
self.assertEqual(0, actual)
self.assertFalse(et_mock.called)
+ def test_help_no_subcommand(self):
+ shell = openstack_shell.OpenStackImagesShell()
+ argstr = '--os-image-api-version 2'
+ with mock.patch.object(shell, '_get_keystone_auth_plugin') as et_mock:
+ actual = shell.main(argstr.split())
+ self.assertEqual(0, actual)
+ self.assertFalse(et_mock.called)
+
def test_blank_call(self):
shell = openstack_shell.OpenStackImagesShell()
with mock.patch.object(shell, '_get_keystone_auth_plugin') as et_mock:
diff --git a/releasenotes/notes/fix-undesirable-raw-python-error-66e3ddaca7b72ae2.yaml b/releasenotes/notes/fix-undesirable-raw-python-error-66e3ddaca7b72ae2.yaml
new file mode 100644
index 0000000..d6fad7d
--- /dev/null
+++ b/releasenotes/notes/fix-undesirable-raw-python-error-66e3ddaca7b72ae2.yaml
@@ -0,0 +1,7 @@
+---
+fixes:
+ - |
+ `Bug #1903727 <https://bugs.launchpad.net/python-glanceclient/+bug/1903727>`_:
+ Fixed raw Python error message when using ``glance`` without
+ a subcommand while passing an optional argument, such as
+ ``--os-image-api-version``.