summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--novaclient/shell.py3
-rw-r--r--novaclient/tests/unit/test_shell.py3
-rw-r--r--releasenotes/notes/fix-raw-python-error-debd3edb17c2f675.yaml7
3 files changed, 13 insertions, 0 deletions
diff --git a/novaclient/shell.py b/novaclient/shell.py
index a81db89a..7762be9b 100644
--- a/novaclient/shell.py
+++ b/novaclient/shell.py
@@ -365,6 +365,9 @@ class OpenStackComputeShell(object):
help=_("Use this API endpoint instead of the Service Catalog. "
"Defaults to env[OS_ENDPOINT_OVERRIDE]."))
+ parser.set_defaults(func=self.do_help)
+ parser.set_defaults(command='')
+
if osprofiler_profiler:
parser.add_argument('--profile',
metavar='HMAC_KEY',
diff --git a/novaclient/tests/unit/test_shell.py b/novaclient/tests/unit/test_shell.py
index 889916ea..64195291 100644
--- a/novaclient/tests/unit/test_shell.py
+++ b/novaclient/tests/unit/test_shell.py
@@ -451,6 +451,9 @@ class ShellTest(utils.TestCase):
def test_help_no_options(self):
self._test_help('')
+ def test_help_no_subcommand(self):
+ self._test_help('--os-compute-api-version 2.87')
+
def test_help_on_subcommand(self):
required = [
'.*?^usage: nova set-password',
diff --git a/releasenotes/notes/fix-raw-python-error-debd3edb17c2f675.yaml b/releasenotes/notes/fix-raw-python-error-debd3edb17c2f675.yaml
new file mode 100644
index 00000000..7686ecbe
--- /dev/null
+++ b/releasenotes/notes/fix-raw-python-error-debd3edb17c2f675.yaml
@@ -0,0 +1,7 @@
+---
+fixes:
+ - |
+ `Bug #1903727 <https://bugs.launchpad.net/python-novaclient/+bug/1903727>`_:
+ Fixed raw Python error message when using ``nova`` without
+ a subcommand while passing an optional argument, such as
+ ``--os-compute-api-version 2.87``.