Merge "Stop ignoring v2password plugin"
This commit is contained in:
commit
b18d05df0f
@ -474,8 +474,8 @@ class OpenStackConfig(object):
|
|||||||
name))
|
name))
|
||||||
|
|
||||||
def _fix_backwards_madness(self, cloud):
|
def _fix_backwards_madness(self, cloud):
|
||||||
cloud = self._fix_backwards_project(cloud)
|
|
||||||
cloud = self._fix_backwards_auth_plugin(cloud)
|
cloud = self._fix_backwards_auth_plugin(cloud)
|
||||||
|
cloud = self._fix_backwards_project(cloud)
|
||||||
cloud = self._fix_backwards_interface(cloud)
|
cloud = self._fix_backwards_interface(cloud)
|
||||||
cloud = self._handle_domain_id(cloud)
|
cloud = self._handle_domain_id(cloud)
|
||||||
return cloud
|
return cloud
|
||||||
@ -507,10 +507,6 @@ class OpenStackConfig(object):
|
|||||||
# Also handle moving domain names into auth so that domain mapping
|
# Also handle moving domain names into auth so that domain mapping
|
||||||
# is easier
|
# is easier
|
||||||
mappings = {
|
mappings = {
|
||||||
'project_id': ('tenant_id', 'tenant-id',
|
|
||||||
'project_id', 'project-id'),
|
|
||||||
'project_name': ('tenant_name', 'tenant-name',
|
|
||||||
'project_name', 'project-name'),
|
|
||||||
'domain_id': ('domain_id', 'domain-id'),
|
'domain_id': ('domain_id', 'domain-id'),
|
||||||
'domain_name': ('domain_name', 'domain-name'),
|
'domain_name': ('domain_name', 'domain-name'),
|
||||||
'user_domain_id': ('user_domain_id', 'user-domain-id'),
|
'user_domain_id': ('user_domain_id', 'user-domain-id'),
|
||||||
@ -520,6 +516,19 @@ class OpenStackConfig(object):
|
|||||||
'project_domain_name', 'project-domain-name'),
|
'project_domain_name', 'project-domain-name'),
|
||||||
'token': ('auth-token', 'auth_token', 'token'),
|
'token': ('auth-token', 'auth_token', 'token'),
|
||||||
}
|
}
|
||||||
|
if cloud.get('auth_type', None) == 'v2password':
|
||||||
|
# If v2password is explcitly requested, this is to deal with old
|
||||||
|
# clouds. That's fine - we need to map settings in the opposite
|
||||||
|
# direction
|
||||||
|
mappings['tenant_id'] = (
|
||||||
|
'project_id', 'project-id', 'tenant_id', 'tenant-id')
|
||||||
|
mappings['tenant_name'] = (
|
||||||
|
'project_name', 'project-name', 'tenant_name', 'tenant-name')
|
||||||
|
else:
|
||||||
|
mappings['project_id'] = (
|
||||||
|
'tenant_id', 'tenant-id', 'project_id', 'project-id')
|
||||||
|
mappings['project_name'] = (
|
||||||
|
'tenant_name', 'tenant-name', 'project_name', 'project-name')
|
||||||
for target_key, possible_values in mappings.items():
|
for target_key, possible_values in mappings.items():
|
||||||
target = None
|
target = None
|
||||||
for key in possible_values:
|
for key in possible_values:
|
||||||
@ -549,8 +558,6 @@ class OpenStackConfig(object):
|
|||||||
# use of the auth plugin that can do auto-selection and dealing
|
# use of the auth plugin that can do auto-selection and dealing
|
||||||
# with that based on auth parameters. v2password is basically
|
# with that based on auth parameters. v2password is basically
|
||||||
# completely broken
|
# completely broken
|
||||||
if cloud['auth_type'] == 'v2password':
|
|
||||||
cloud['auth_type'] = 'password'
|
|
||||||
return cloud
|
return cloud
|
||||||
|
|
||||||
def register_argparse_arguments(self, parser, argv, service_keys=[]):
|
def register_argparse_arguments(self, parser, argv, service_keys=[]):
|
||||||
|
@ -713,3 +713,43 @@ class TestBackwardsCompatibility(base.TestCase):
|
|||||||
'auth_type': 'v3password',
|
'auth_type': 'v3password',
|
||||||
}
|
}
|
||||||
self.assertDictEqual(expected, result)
|
self.assertDictEqual(expected, result)
|
||||||
|
|
||||||
|
def test_project_v2password(self):
|
||||||
|
c = config.OpenStackConfig(config_files=[self.cloud_yaml],
|
||||||
|
vendor_files=[self.vendor_yaml])
|
||||||
|
cloud = {
|
||||||
|
'auth_type': 'v2password',
|
||||||
|
'auth': {
|
||||||
|
'project-name': 'my_project_name',
|
||||||
|
'project-id': 'my_project_id'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
result = c._fix_backwards_project(cloud)
|
||||||
|
expected = {
|
||||||
|
'auth_type': 'v2password',
|
||||||
|
'auth': {
|
||||||
|
'tenant_name': 'my_project_name',
|
||||||
|
'tenant_id': 'my_project_id'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
self.assertEqual(expected, result)
|
||||||
|
|
||||||
|
def test_project_password(self):
|
||||||
|
c = config.OpenStackConfig(config_files=[self.cloud_yaml],
|
||||||
|
vendor_files=[self.vendor_yaml])
|
||||||
|
cloud = {
|
||||||
|
'auth_type': 'password',
|
||||||
|
'auth': {
|
||||||
|
'project-name': 'my_project_name',
|
||||||
|
'project-id': 'my_project_id'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
result = c._fix_backwards_project(cloud)
|
||||||
|
expected = {
|
||||||
|
'auth_type': 'password',
|
||||||
|
'auth': {
|
||||||
|
'project_name': 'my_project_name',
|
||||||
|
'project_id': 'my_project_id'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
self.assertEqual(expected, result)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user