Merge "Add domain id information to identity-credentials"

This commit is contained in:
Zuul 2019-03-04 11:04:10 +00:00 committed by Gerrit Code Review
commit 3e86202e94
2 changed files with 12 additions and 0 deletions

View File

@ -1757,6 +1757,13 @@ def add_credentials_to_keystone(relation_id=None, remote_unit=None):
}
if domain:
relation_data['domain'] = domain
# The same domain is used for project and user creation. However, in
# the future they may not be.
domain_id = manager.resolve_domain_id(domain)
relation_data['credentials_user_domain_name'] = domain
relation_data['credentials_user_domain_id'] = domain_id
relation_data['credentials_project_domain_name'] = domain
relation_data['credentials_project_domain_id'] = domain_id
peer_store_and_set(relation_id=relation_id, **relation_data)

View File

@ -1067,6 +1067,7 @@ class TestKeystoneUtils(CharmTestCase):
""" Verify add_credentials with Keystone V3 """
manager = MagicMock()
manager.resolve_tenant_id.return_value = 'abcdef0123456789'
manager.resolve_domain_id.return_value = 'a-domain-id'
get_manager.return_value = manager
remote_unit = 'unit/0'
relation_id = 'identity-credentials:0'
@ -1090,6 +1091,10 @@ class TestKeystoneUtils(CharmTestCase):
'credentials_password': 'password',
'credentials_project': 'services',
'credentials_project_id': 'abcdef0123456789',
'credentials_user_domain_id': 'a-domain-id',
'credentials_project_domain_id': 'a-domain-id',
'credentials_project_domain_name': 'Non-Default',
'credentials_user_domain_name': 'Non-Default',
'region': 'RegionOne',
'domain': 'Non-Default',
'api_version': 3}