diff options
author | Monty Taylor <mordred@inaugust.com> | 2015-12-12 17:26:09 -0500 |
---|---|---|
committer | Monty Taylor <mordred@inaugust.com> | 2015-12-21 09:37:30 -0600 |
commit | 0a25cb5c5059fc8f850e27a984613515ae76ee11 (patch) | |
tree | a96d3ef0d071073162988cdeb85b02868916b6c2 | |
parent | 16166c03c27fe73896a1717ad9a145a466bc0afd (diff) | |
download | os-client-config-0a25cb5c5059fc8f850e27a984613515ae76ee11.tar.gz |
Allow passing in explicit version for legacy_client
Nova (and indeed other clients with microversions, need a user to be
able to request an explicit version.
Change-Id: I5f67b7fc007b7d6123f621c5943345f88db1f84b
-rw-r--r-- | os_client_config/cloud_config.py | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/os_client_config/cloud_config.py b/os_client_config/cloud_config.py index 2f3c94a..0233eff 100644 --- a/os_client_config/cloud_config.py +++ b/os_client_config/cloud_config.py @@ -255,7 +255,7 @@ class CloudConfig(object): def get_legacy_client( self, service_key, client_class=None, interface_key=None, - pass_version_arg=True, **kwargs): + pass_version_arg=True, version=None, **kwargs): """Return a legacy OpenStack client object for the given config. Most of the OpenStack python-*client libraries have the same @@ -287,6 +287,8 @@ class CloudConfig(object): already understand that this is the case for network, so it can be omitted in that case. + :param version: (optional) Version string to override the configured + version string. :param kwargs: (optional) keyword args are passed through to the Client constructor, so this is in case anything additional needs to be passed in. @@ -320,13 +322,14 @@ class CloudConfig(object): # would need to do if they were requesting 'image' - then # they necessarily have glanceclient installed from glanceclient.common import utils as glance_utils - endpoint, version = glance_utils.strip_version(endpoint) + endpoint, _ = glance_utils.strip_version(endpoint) constructor_kwargs['endpoint'] = endpoint constructor_kwargs.update(kwargs) constructor_kwargs[interface_key] = interface constructor_args = [] if pass_version_arg: - version = self.get_api_version(service_key) + if not version: + version = self.get_api_version(service_key) # Temporary workaround while we wait for python-openstackclient # to be able to handle 2.0 which is what neutronclient expects if service_key == 'network' and version == '2': |