Pass version arg by name not position
Everyone except neutron has a first parameter called "version" - so we can pass it by name. For neutron, add a workaround, becuase YAY people being different. Change-Id: Icfd92e5e31763ffccc1ff673298f89d1888941fe
This commit is contained in:
parent
570ed32fa1
commit
cd5f16cc4d
@ -335,7 +335,6 @@ class CloudConfig(object):
|
|||||||
constructor_kwargs['endpoint_override'] = endpoint
|
constructor_kwargs['endpoint_override'] = endpoint
|
||||||
constructor_kwargs.update(kwargs)
|
constructor_kwargs.update(kwargs)
|
||||||
constructor_kwargs[interface_key] = interface
|
constructor_kwargs[interface_key] = interface
|
||||||
constructor_args = []
|
|
||||||
if pass_version_arg:
|
if pass_version_arg:
|
||||||
if not version:
|
if not version:
|
||||||
version = self.get_api_version(service_key)
|
version = self.get_api_version(service_key)
|
||||||
@ -348,12 +347,12 @@ class CloudConfig(object):
|
|||||||
if 'endpoint' not in constructor_kwargs:
|
if 'endpoint' not in constructor_kwargs:
|
||||||
endpoint = self.get_session_endpoint('identity')
|
endpoint = self.get_session_endpoint('identity')
|
||||||
constructor_kwargs['endpoint'] = endpoint
|
constructor_kwargs['endpoint'] = endpoint
|
||||||
if service_key == 'key-manager':
|
if service_key == 'network':
|
||||||
constructor_kwargs['version'] = version
|
constructor_kwargs['api_version'] = version
|
||||||
else:
|
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):
|
def _get_swift_client(self, client_class, **kwargs):
|
||||||
session = self.get_session()
|
session = self.get_session()
|
||||||
|
@ -304,7 +304,7 @@ class TestCloudConfig(base.TestCase):
|
|||||||
"test1", "region-al", config_dict, auth_plugin=mock.Mock())
|
"test1", "region-al", config_dict, auth_plugin=mock.Mock())
|
||||||
cc.get_legacy_client('image', mock_client)
|
cc.get_legacy_client('image', mock_client)
|
||||||
mock_client.assert_called_with(
|
mock_client.assert_called_with(
|
||||||
2.0,
|
version=2.0,
|
||||||
service_name=None,
|
service_name=None,
|
||||||
endpoint_override='http://example.com',
|
endpoint_override='http://example.com',
|
||||||
region_name='region-al',
|
region_name='region-al',
|
||||||
@ -325,7 +325,7 @@ class TestCloudConfig(base.TestCase):
|
|||||||
"test1", "region-al", config_dict, auth_plugin=mock.Mock())
|
"test1", "region-al", config_dict, auth_plugin=mock.Mock())
|
||||||
cc.get_legacy_client('image', mock_client)
|
cc.get_legacy_client('image', mock_client)
|
||||||
mock_client.assert_called_with(
|
mock_client.assert_called_with(
|
||||||
2.0,
|
version=2.0,
|
||||||
service_name=None,
|
service_name=None,
|
||||||
endpoint_override='http://example.com/override',
|
endpoint_override='http://example.com/override',
|
||||||
region_name='region-al',
|
region_name='region-al',
|
||||||
@ -347,7 +347,7 @@ class TestCloudConfig(base.TestCase):
|
|||||||
"test1", "region-al", config_dict, auth_plugin=mock.Mock())
|
"test1", "region-al", config_dict, auth_plugin=mock.Mock())
|
||||||
cc.get_legacy_client('image', mock_client)
|
cc.get_legacy_client('image', mock_client)
|
||||||
mock_client.assert_called_with(
|
mock_client.assert_called_with(
|
||||||
2.0,
|
version=2.0,
|
||||||
service_name=None,
|
service_name=None,
|
||||||
endpoint_override='http://example.com',
|
endpoint_override='http://example.com',
|
||||||
region_name='region-al',
|
region_name='region-al',
|
||||||
@ -369,7 +369,7 @@ class TestCloudConfig(base.TestCase):
|
|||||||
"test1", "region-al", config_dict, auth_plugin=mock.Mock())
|
"test1", "region-al", config_dict, auth_plugin=mock.Mock())
|
||||||
cc.get_legacy_client('image', mock_client)
|
cc.get_legacy_client('image', mock_client)
|
||||||
mock_client.assert_called_with(
|
mock_client.assert_called_with(
|
||||||
'1',
|
version='1',
|
||||||
service_name=None,
|
service_name=None,
|
||||||
endpoint_override='http://example.com',
|
endpoint_override='http://example.com',
|
||||||
region_name='region-al',
|
region_name='region-al',
|
||||||
@ -391,7 +391,7 @@ class TestCloudConfig(base.TestCase):
|
|||||||
"test1", "region-al", config_dict, auth_plugin=mock.Mock())
|
"test1", "region-al", config_dict, auth_plugin=mock.Mock())
|
||||||
cc.get_legacy_client('image', mock_client, version='beef')
|
cc.get_legacy_client('image', mock_client, version='beef')
|
||||||
mock_client.assert_called_with(
|
mock_client.assert_called_with(
|
||||||
'beef',
|
version='beef',
|
||||||
service_name=None,
|
service_name=None,
|
||||||
endpoint_override='http://example.com',
|
endpoint_override='http://example.com',
|
||||||
region_name='region-al',
|
region_name='region-al',
|
||||||
@ -411,7 +411,7 @@ class TestCloudConfig(base.TestCase):
|
|||||||
"test1", "region-al", config_dict, auth_plugin=mock.Mock())
|
"test1", "region-al", config_dict, auth_plugin=mock.Mock())
|
||||||
cc.get_legacy_client('network', mock_client)
|
cc.get_legacy_client('network', mock_client)
|
||||||
mock_client.assert_called_with(
|
mock_client.assert_called_with(
|
||||||
'2.0',
|
api_version='2.0',
|
||||||
endpoint_type='public',
|
endpoint_type='public',
|
||||||
endpoint_override=None,
|
endpoint_override=None,
|
||||||
region_name='region-al',
|
region_name='region-al',
|
||||||
@ -429,7 +429,7 @@ class TestCloudConfig(base.TestCase):
|
|||||||
"test1", "region-al", config_dict, auth_plugin=mock.Mock())
|
"test1", "region-al", config_dict, auth_plugin=mock.Mock())
|
||||||
cc.get_legacy_client('compute', mock_client)
|
cc.get_legacy_client('compute', mock_client)
|
||||||
mock_client.assert_called_with(
|
mock_client.assert_called_with(
|
||||||
'2',
|
version='2',
|
||||||
endpoint_type='public',
|
endpoint_type='public',
|
||||||
endpoint_override='http://compute.example.com',
|
endpoint_override='http://compute.example.com',
|
||||||
region_name='region-al',
|
region_name='region-al',
|
||||||
@ -447,7 +447,7 @@ class TestCloudConfig(base.TestCase):
|
|||||||
"test1", "region-al", config_dict, auth_plugin=mock.Mock())
|
"test1", "region-al", config_dict, auth_plugin=mock.Mock())
|
||||||
cc.get_legacy_client('identity', mock_client)
|
cc.get_legacy_client('identity', mock_client)
|
||||||
mock_client.assert_called_with(
|
mock_client.assert_called_with(
|
||||||
'2.0',
|
version='2.0',
|
||||||
endpoint='http://example.com/v2',
|
endpoint='http://example.com/v2',
|
||||||
endpoint_type='admin',
|
endpoint_type='admin',
|
||||||
endpoint_override=None,
|
endpoint_override=None,
|
||||||
@ -467,7 +467,7 @@ class TestCloudConfig(base.TestCase):
|
|||||||
"test1", "region-al", config_dict, auth_plugin=mock.Mock())
|
"test1", "region-al", config_dict, auth_plugin=mock.Mock())
|
||||||
cc.get_legacy_client('identity', mock_client)
|
cc.get_legacy_client('identity', mock_client)
|
||||||
mock_client.assert_called_with(
|
mock_client.assert_called_with(
|
||||||
'3',
|
version='3',
|
||||||
endpoint='http://example.com',
|
endpoint='http://example.com',
|
||||||
endpoint_type='admin',
|
endpoint_type='admin',
|
||||||
endpoint_override=None,
|
endpoint_override=None,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user