summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJenkins <jenkins@review.openstack.org>2015-11-05 16:49:34 +0000
committerGerrit Code Review <review@openstack.org>2015-11-05 16:49:34 +0000
commit1b91e007fdeda8703056d50abe431e167afb9e03 (patch)
tree300aeef57b650021f5b7d282719c0635cb50dc37
parentb8874ffc98488500fd4b573f7fa6196d3997e84e (diff)
parentd373969b98cd1db9188085dc2cd0b7754c687ff6 (diff)
downloados-client-config-1b91e007fdeda8703056d50abe431e167afb9e03.tar.gz
Merge "Don't assume pass_version_arg=False for network"1.10.0
-rw-r--r--os_client_config/cloud_config.py16
-rw-r--r--os_client_config/tests/test_cloud_config.py9
2 files changed, 13 insertions, 12 deletions
diff --git a/os_client_config/cloud_config.py b/os_client_config/cloud_config.py
index 17941c9..8e0b963 100644
--- a/os_client_config/cloud_config.py
+++ b/os_client_config/cloud_config.py
@@ -238,10 +238,8 @@ class CloudConfig(object):
interface_key = 'interface'
else:
interface_key = 'endpoint_type'
- if service_key == 'network':
- pass_version_arg = False
- constructor_args = dict(
+ constructor_kwargs = dict(
session=self.get_session(),
service_name=self.get_service_name(service_key),
service_type=self.get_service_type(service_key),
@@ -254,13 +252,15 @@ class CloudConfig(object):
# they necessarily have glanceclient installed
from glanceclient.common import utils as glance_utils
endpoint, version = glance_utils.strip_version(endpoint)
- constructor_args['endpoint'] = endpoint
- constructor_args.update(kwargs)
- constructor_args[interface_key] = interface
+ 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)
- constructor_args['version'] = version
- return client_class(**constructor_args)
+ constructor_args.append(version)
+
+ return client_class(*constructor_args, **constructor_kwargs)
def _get_swift_client(self, client_class, **kwargs):
session = self.get_session()
diff --git a/os_client_config/tests/test_cloud_config.py b/os_client_config/tests/test_cloud_config.py
index f5ceac7..080f100 100644
--- a/os_client_config/tests/test_cloud_config.py
+++ b/os_client_config/tests/test_cloud_config.py
@@ -24,7 +24,7 @@ from os_client_config.tests import base
fake_config_dict = {'a': 1, 'os_b': 2, 'c': 3, 'os_c': 4}
fake_services_dict = {
- 'compute_api_version': 2,
+ 'compute_api_version': '2',
'compute_endpoint': 'http://compute.example.com',
'compute_region_name': 'region-bl',
'interface': 'public',
@@ -139,7 +139,7 @@ class TestCloudConfig(base.TestCase):
self.assertEqual('region-al', cc.get_region_name('image'))
self.assertEqual('region-bl', cc.get_region_name('compute'))
self.assertEqual(None, cc.get_api_version('image'))
- self.assertEqual(2, cc.get_api_version('compute'))
+ self.assertEqual('2', cc.get_api_version('compute'))
self.assertEqual('mage', cc.get_service_type('image'))
self.assertEqual('compute', cc.get_service_type('compute'))
self.assertEqual('http://compute.example.com',
@@ -235,7 +235,7 @@ class TestCloudConfig(base.TestCase):
"test1", "region-al", config_dict, auth_plugin=mock.Mock())
cc.get_legacy_client('image', mock_client)
mock_client.assert_called_with(
- version='2',
+ '2',
service_name=None,
endpoint='http://example.com',
region_name='region-al',
@@ -255,6 +255,7 @@ class TestCloudConfig(base.TestCase):
"test1", "region-al", config_dict, auth_plugin=mock.Mock())
cc.get_legacy_client('network', mock_client)
mock_client.assert_called_with(
+ '2.0',
endpoint_type='public',
region_name='region-al',
service_type='network',
@@ -271,7 +272,7 @@ class TestCloudConfig(base.TestCase):
"test1", "region-al", config_dict, auth_plugin=mock.Mock())
cc.get_legacy_client('compute', mock_client)
mock_client.assert_called_with(
- version=2,
+ '2',
endpoint_type='public',
region_name='region-al',
service_type='compute',