Merge "Pass version arg by name not position"

This commit is contained in:
Jenkins 2016-01-13 20:46:18 +00:00 committed by Gerrit Code Review
commit 8a6dd7f9bc
2 changed files with 13 additions and 14 deletions

View File

@ -335,7 +335,6 @@ class CloudConfig(object):
constructor_kwargs['endpoint_override'] = endpoint
constructor_kwargs.update(kwargs)
constructor_kwargs[interface_key] = interface
constructor_args = []
if pass_version_arg:
if not version:
version = self.get_api_version(service_key)
@ -348,12 +347,12 @@ class CloudConfig(object):
if 'endpoint' not in constructor_kwargs:
endpoint = self.get_session_endpoint('identity')
constructor_kwargs['endpoint'] = endpoint
if service_key == 'key-manager':
constructor_kwargs['version'] = version
if service_key == 'network':
constructor_kwargs['api_version'] = version
else:
constructor_args.append(version)
constructor_kwargs['version'] = version
return client_class(*constructor_args, **constructor_kwargs)
return client_class(**constructor_kwargs)
def _get_swift_client(self, client_class, **kwargs):
session = self.get_session()

View File

@ -304,7 +304,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(
2.0,
version=2.0,
service_name=None,
endpoint_override='http://example.com',
region_name='region-al',
@ -325,7 +325,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(
2.0,
version=2.0,
service_name=None,
endpoint_override='http://example.com/override',
region_name='region-al',
@ -347,7 +347,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(
2.0,
version=2.0,
service_name=None,
endpoint_override='http://example.com',
region_name='region-al',
@ -369,7 +369,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(
'1',
version='1',
service_name=None,
endpoint_override='http://example.com',
region_name='region-al',
@ -391,7 +391,7 @@ class TestCloudConfig(base.TestCase):
"test1", "region-al", config_dict, auth_plugin=mock.Mock())
cc.get_legacy_client('image', mock_client, version='beef')
mock_client.assert_called_with(
'beef',
version='beef',
service_name=None,
endpoint_override='http://example.com',
region_name='region-al',
@ -411,7 +411,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',
api_version='2.0',
endpoint_type='public',
endpoint_override=None,
region_name='region-al',
@ -429,7 +429,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(
'2',
version='2',
endpoint_type='public',
endpoint_override='http://compute.example.com',
region_name='region-al',
@ -447,7 +447,7 @@ class TestCloudConfig(base.TestCase):
"test1", "region-al", config_dict, auth_plugin=mock.Mock())
cc.get_legacy_client('identity', mock_client)
mock_client.assert_called_with(
'2.0',
version='2.0',
endpoint='http://example.com/v2',
endpoint_type='admin',
endpoint_override=None,
@ -467,7 +467,7 @@ class TestCloudConfig(base.TestCase):
"test1", "region-al", config_dict, auth_plugin=mock.Mock())
cc.get_legacy_client('identity', mock_client)
mock_client.assert_called_with(
'3',
version='3',
endpoint='http://example.com',
endpoint_type='admin',
endpoint_override=None,