Rename NOVA_VERSION to OS_COMPUTE_API_VERSION.

Fixes bug 940432.

Change-Id: I18187eb68d936632b4ae78676a0a9f062afba8f2
This commit is contained in:
Josh Kearney 2012-04-12 14:16:31 -05:00
parent d6d7386fad
commit 765f551a26
4 changed files with 22 additions and 19 deletions

View File

@ -52,7 +52,7 @@ and the version of the API with ``--version``. Or set them as an environment
variables as well::
export OS_AUTH_URL=http://example.com:8774/v1.1/
export NOVA_VERSION=1.1
export OS_COMPUTE_API_VERSION=1.1
If you are using Keystone, you need to set the NOVA_URL to the keystone
endpoint::
@ -213,7 +213,8 @@ You'll find complete documentation on the shell by running
Defaults to env[NOVA_SERVICE_NAME]
--endpoint_type ENDPOINT_TYPE
Defaults to env[NOVA_ENDPOINT_TYPE] or publicURL.
--version VERSION Accepts 1.1, defaults to env[NOVA_VERSION].
--os_compute_api_version VERSION
Accepts 1.1, defaults to env[OS_COMPUTE_API_VERSION].
--username USERNAME Deprecated
--region_name REGION_NAME
Deprecated

View File

@ -31,7 +31,7 @@ environment variables by setting two environment variables:
The OpenStack API server URL.
.. envvar:: NOVA_VERSION
.. envvar:: OS_COMPUTE_API_VERSION
The OpenStack API version.
@ -41,7 +41,7 @@ For example, in Bash you'd use::
export OS_PASSWORD=yadayadayada
export OS_TENANT_NAME=myproject
export OS_AUTH_URL=http://...
export NOVA_VERSION=1.1
export OS_COMPUTE_API_VERSION=1.1
From there, all shell commands take the form::

View File

@ -34,7 +34,7 @@ import novaclient.extension
from novaclient import utils
from novaclient.v1_1 import shell as shell_v1_1
DEFAULT_NOVA_VERSION = "1.1"
DEFAULT_OS_COMPUTE_API_VERSION = "1.1"
DEFAULT_NOVA_ENDPOINT_TYPE = 'publicURL'
DEFAULT_NOVA_SERVICE_TYPE = 'compute'
@ -119,9 +119,10 @@ class OpenStackComputeShell(object):
help='Defaults to env[NOVA_ENDPOINT_TYPE] or '
+ DEFAULT_NOVA_ENDPOINT_TYPE + '.')
parser.add_argument('--version',
default=utils.env('NOVA_VERSION', default=DEFAULT_NOVA_VERSION),
help='Accepts 1.1, defaults to env[NOVA_VERSION].')
parser.add_argument('--os_compute_api_version',
default=utils.env('OS_COMPUTE_API_VERSION',
default=DEFAULT_OS_COMPUTE_API_VERSION),
help='Accepts 1.1, defaults to env[OS_COMPUTE_API_VERSION].')
parser.add_argument('--insecure',
default=utils.env('NOVACLIENT_INSECURE', default=False),
@ -267,10 +268,12 @@ class OpenStackComputeShell(object):
self.setup_debugging(options.debug)
# build available subcommands based on version
self.extensions = self._discover_extensions(options.version)
self.extensions = self._discover_extensions(
options.os_compute_api_version)
self._run_extension_hooks('__pre_parse_args__')
subcommand_parser = self.get_subcommand_parser(options.version)
subcommand_parser = self.get_subcommand_parser(
options.os_compute_api_version)
self.parser = subcommand_parser
if options.help and len(args) == 0:
@ -343,7 +346,8 @@ class OpenStackComputeShell(object):
if not os_region_name and region_name:
os_region_name = region_name
if options.version and options.version != '1.0':
if (options.os_compute_api_version and
options.os_compute_api_version != '1.0'):
if not os_tenant_name:
raise exc.CommandError("You must provide a tenant name "
"via either --os_tenant_name or env[OS_TENANT_NAME]")
@ -352,13 +356,11 @@ class OpenStackComputeShell(object):
raise exc.CommandError("You must provide an auth url "
"via either --os_auth_url or env[OS_AUTH_URL]")
self.cs = client.Client(options.version, os_username, os_password,
os_tenant_name, os_auth_url, insecure,
region_name=os_region_name,
endpoint_type=endpoint_type,
extensions=self.extensions,
service_type=service_type,
service_name=service_name)
self.cs = client.Client(options.os_compute_api_version, os_username,
os_password, os_tenant_name, os_auth_url, insecure,
region_name=os_region_name, endpoint_type=endpoint_type,
extensions=self.extensions, service_type=service_type,
service_name=service_name)
try:
if not utils.isunauthenticated(args.func):

View File

@ -37,7 +37,7 @@ class ShellTest(utils.TestCase):
'NOVA_USERNAME': 'username',
'NOVA_PASSWORD': 'password',
'NOVA_PROJECT_ID': 'project_id',
'NOVA_VERSION': '1.1',
'OS_COMPUTE_API_VERSION': '1.1',
'NOVA_URL': 'http://no.where',
}