diff --git a/doc/source/cli/nova.rst b/doc/source/cli/nova.rst index cd6d60eeb..14f63c4cb 100644 --- a/doc/source/cli/nova.rst +++ b/doc/source/cli/nova.rst @@ -33,7 +33,7 @@ nova usage [--service-name ] [--os-endpoint-type ] [--os-compute-api-version ] - [--endpoint-override ] [--profile HMAC_KEY] + [--os-endpoint-override ] [--profile HMAC_KEY] [--insecure] [--os-cacert ] [--os-cert ] [--os-key ] [--timeout ] [--os-auth-type ] [--os-auth-url OS_AUTH_URL] @@ -678,10 +678,10 @@ nova optional arguments minor part) or "X.latest", defaults to ``env[OS_COMPUTE_API_VERSION]``. -``--endpoint-override `` +``--os-endpoint-override `` Use this API endpoint instead of the Service Catalog. Defaults to - ``env[NOVACLIENT_ENDPOINT_OVERRIDE]``. + ``env[OS_ENDPOINT_OVERRIDE]``. ``--profile HMAC_KEY`` HMAC key to use for encrypting context data diff --git a/novaclient/shell.py b/novaclient/shell.py index 834712437..8eb4311ce 100644 --- a/novaclient/shell.py +++ b/novaclient/shell.py @@ -358,19 +358,32 @@ class OpenStackComputeShell(object): '"X.latest", defaults to env[OS_COMPUTE_API_VERSION].')) parser.add_argument( - '--endpoint-override', + '--os-endpoint-override', metavar='', dest='endpoint_override', - default=utils.env('NOVACLIENT_ENDPOINT_OVERRIDE', + default=utils.env('OS_ENDPOINT_OVERRIDE', + 'NOVACLIENT_ENDPOINT_OVERRIDE', 'NOVACLIENT_BYPASS_URL'), help=_("Use this API endpoint instead of the Service Catalog. " - "Defaults to env[NOVACLIENT_ENDPOINT_OVERRIDE].")) + "Defaults to env[OS_ENDPOINT_OVERRIDE].")) + + # NOTE(takashin): This dummy '--end' argument was added + # to avoid misinterpreting command line arguments. + # If there is not this dummy argument, the '--end' is interpreted to + # the '--endpoint-override'. + # TODO(takashin): Remove this dummy '--end' argument + # when the deprecated '--endpoint-override' argument is removed. + parser.add_argument( + '--end', + metavar='', + nargs='?', + help=argparse.SUPPRESS) parser.add_argument( - '--bypass-url', + '--endpoint-override', action=DeprecatedAction, - use=_('use "%s"; this option will be removed after Pike OpenStack ' - 'release.') % '--os-endpoint-override', + use=_('use "%s"; this option will be removed after Rocky ' + 'OpenStack release.') % '--os-endpoint-override', dest='endpoint_override', help=argparse.SUPPRESS) diff --git a/novaclient/tests/functional/v2/legacy/test_readonly_nova.py b/novaclient/tests/functional/v2/legacy/test_readonly_nova.py index df88b8c6d..6b9598e96 100644 --- a/novaclient/tests/functional/v2/legacy/test_readonly_nova.py +++ b/novaclient/tests/functional/v2/legacy/test_readonly_nova.py @@ -124,4 +124,4 @@ class SimpleReadOnlyNovaClientTest(base.ClientTestBase): self.assertRaises(exceptions.CommandFailed, self.nova, 'list', - flags='--endpoint-override badurl') + flags='--os-endpoint-override badurl') diff --git a/releasenotes/notes/bug-1778536-a1b5d65a0d4ad622.yaml b/releasenotes/notes/bug-1778536-a1b5d65a0d4ad622.yaml new file mode 100644 index 000000000..3e5410aad --- /dev/null +++ b/releasenotes/notes/bug-1778536-a1b5d65a0d4ad622.yaml @@ -0,0 +1,12 @@ +--- +upgrade: + - The deprecated ``--bypass-url`` command line argument has been removed. +deprecations: + - | + The ``--endpoint-override`` command line argument has been deprecated. + It is renamed to ``--os-endpoint-override`` to avoid misinterpreting + command line arguments. + It defaults to the ``OS_ENDPOINT_OVERRIDE`` environment variable. + See `bug 1778536`_ for more details. + + .. _bug 1778536: https://bugs.launchpad.net/python-novaclient/+bug/1778536