summaryrefslogtreecommitdiff
path: root/openstackclient
diff options
context:
space:
mode:
authorDean Troyer <dtroyer@gmail.com>2014-11-14 17:27:58 -0600
committerDean Troyer <dtroyer@gmail.com>2014-11-16 11:37:52 -0600
commit2b02beaa5182e678d9da00402a7c4f137710f813 (patch)
tree99a6883d59820098e99e0e8cb6f6898e16cc2654 /openstackclient
parentf5a2811b6546007eac055151e320005c0d4410d0 (diff)
downloadpython-openstackclient-2b02beaa5182e678d9da00402a7c4f137710f813.tar.gz
Liberalize version matching a bit
For class-loading purposes we can just use the major version, so accept that. Only Identity and Compute were affected; Compute is included just to be pedantically complete. For command groups we also just use the major version so fix Compute and the version option handling. Change the internal default for Identity to a simple '2' so it is also consistent with the rest of the world. Then comes microversioning... Closes-Bug: #1292638 Change-Id: Ibaf823b31caa288a83de38d2c258860b128b87d8
Diffstat (limited to 'openstackclient')
-rw-r--r--openstackclient/compute/client.py1
-rw-r--r--openstackclient/identity/client.py10
-rw-r--r--openstackclient/shell.py3
-rw-r--r--openstackclient/tests/test_shell.py6
4 files changed, 12 insertions, 8 deletions
diff --git a/openstackclient/compute/client.py b/openstackclient/compute/client.py
index c87bbee7..3725350a 100644
--- a/openstackclient/compute/client.py
+++ b/openstackclient/compute/client.py
@@ -27,6 +27,7 @@ API_VERSION_OPTION = 'os_compute_api_version'
API_NAME = 'compute'
API_VERSIONS = {
'1.1': 'novaclient.v1_1.client.Client',
+ '1': 'novaclient.v1_1.client.Client',
'2': 'novaclient.v1_1.client.Client',
}
diff --git a/openstackclient/identity/client.py b/openstackclient/identity/client.py
index 8050d120..daf24e12 100644
--- a/openstackclient/identity/client.py
+++ b/openstackclient/identity/client.py
@@ -15,23 +15,25 @@
import logging
-from keystoneclient.v2_0 import client as identity_client_v2_0
+from keystoneclient.v2_0 import client as identity_client_v2
from openstackclient.api import auth
from openstackclient.common import utils
LOG = logging.getLogger(__name__)
-DEFAULT_IDENTITY_API_VERSION = '2.0'
+DEFAULT_IDENTITY_API_VERSION = '2'
API_VERSION_OPTION = 'os_identity_api_version'
API_NAME = 'identity'
API_VERSIONS = {
- '2.0': 'openstackclient.identity.client.IdentityClientv2_0',
+ '2.0': 'openstackclient.identity.client.IdentityClientv2',
+ '2': 'openstackclient.identity.client.IdentityClientv2',
'3': 'keystoneclient.v3.client.Client',
}
# Translate our API version to auth plugin version prefix
AUTH_VERSIONS = {
'2.0': 'v2',
+ '2': 'v2',
'3': 'v3',
}
@@ -66,7 +68,7 @@ def build_option_parser(parser):
return auth.build_auth_plugins_option_parser(parser)
-class IdentityClientv2_0(identity_client_v2_0.Client):
+class IdentityClientv2(identity_client_v2.Client):
"""Tweak the earlier client class to deal with some changes"""
def __getattr__(self, name):
# Map v3 'projects' back to v2 'tenants'
diff --git a/openstackclient/shell.py b/openstackclient/shell.py
index 1198bae1..ac5556af 100644
--- a/openstackclient/shell.py
+++ b/openstackclient/shell.py
@@ -255,7 +255,8 @@ class OpenStackShell(app.App):
if version_opt:
api = mod.API_NAME
self.api_version[api] = version_opt
- version = '.v' + version_opt.replace('.', '_')
+ # Command groups deal only with major versions
+ version = '.v' + version_opt.replace('.', '_').split('_')[0]
cmd_group = 'openstack.' + api.replace('-', '_') + version
self.command_manager.add_command_group(cmd_group)
self.log.debug(
diff --git a/openstackclient/tests/test_shell.py b/openstackclient/tests/test_shell.py
index 837a48af..8656d089 100644
--- a/openstackclient/tests/test_shell.py
+++ b/openstackclient/tests/test_shell.py
@@ -38,13 +38,13 @@ DEFAULT_AUTH_PLUGIN = "v2password"
DEFAULT_COMPUTE_API_VERSION = "2"
-DEFAULT_IDENTITY_API_VERSION = "2.0"
-DEFAULT_IMAGE_API_VERSION = "v2"
+DEFAULT_IDENTITY_API_VERSION = "2"
+DEFAULT_IMAGE_API_VERSION = "2"
DEFAULT_VOLUME_API_VERSION = "1"
DEFAULT_NETWORK_API_VERSION = "2"
LIB_COMPUTE_API_VERSION = "2"
-LIB_IDENTITY_API_VERSION = "2.0"
+LIB_IDENTITY_API_VERSION = "2"
LIB_IMAGE_API_VERSION = "1"
LIB_VOLUME_API_VERSION = "1"
LIB_NETWORK_API_VERSION = "2"