Skip to content

Commit

Permalink
Set service_user_id from keystone relation (#894)
Browse files Browse the repository at this point in the history
This is necessary so we can avoid ambiguities (by using the id vs
name) when we want to use the service user.

(cherry picked from commit f7e65d2)
(cherry picked from commit 2320efd)
(cherry picked from commit 7e325de)
(cherry picked from commit 57331d4)

Co-authored-by: Erlon R. Cruz <erlon@canonical.com>
  • Loading branch information
rodrigogansobarbieri and sombrafam authored Apr 19, 2024
1 parent d7b18c4 commit 4669229
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
3 changes: 2 additions & 1 deletion charmhelpers/contrib/openstack/context.py
Original file line number Diff line number Diff line change
Expand Up @@ -477,7 +477,7 @@ def __call__(self):
'service_project_id': rdata.get('service_tenant_id'),
'service_domain_id': rdata.get('service_domain_id')})

# we keep all veriables in ctxt for compatibility and
# we keep all variables in ctxt for compatibility and
# add nested dictionary for keystone_authtoken generic
# templating
if keystonemiddleware_os_release:
Expand All @@ -489,6 +489,7 @@ def __call__(self):
# NOTE(jamespage) this is required for >= icehouse
# so a missing value just indicates keystone needs
# upgrading
ctxt['admin_user_id'] = rdata.get('service_user_id')
ctxt['admin_tenant_id'] = rdata.get('service_tenant_id')
ctxt['admin_domain_id'] = rdata.get('service_domain_id')
return ctxt
Expand Down
8 changes: 8 additions & 0 deletions tests/contrib/openstack/test_os_contexts.py
Original file line number Diff line number Diff line change
Expand Up @@ -1032,6 +1032,7 @@ def test_identity_service_context_with_data(self, *args):
'admin_tenant_id': None,
'admin_domain_id': None,
'admin_user': 'adam',
'admin_user_id': None,
'auth_host': 'keystone-host.local',
'auth_port': '35357',
'auth_protocol': 'http',
Expand Down Expand Up @@ -1089,6 +1090,7 @@ def test_identity_service_context_with_altname(self, *args):
'admin_tenant_id': None,
'admin_domain_id': None,
'admin_user': 'adam',
'admin_user_id': None,
'auth_host': 'keystone-host.local',
'auth_port': '35357',
'auth_protocol': 'http',
Expand Down Expand Up @@ -1121,6 +1123,7 @@ def test_identity_service_context_with_cache(self, *args):
'admin_tenant_id': None,
'admin_domain_id': None,
'admin_user': 'adam',
'admin_user_id': None,
'auth_host': 'keystone-host.local',
'auth_port': '35357',
'auth_protocol': 'http',
Expand Down Expand Up @@ -1152,6 +1155,7 @@ def test_identity_service_context_with_data_http(self, *args):
'admin_tenant_id': '123456',
'admin_domain_id': None,
'admin_user': 'adam',
'admin_user_id': None,
'auth_host': 'keystone-host.local',
'auth_port': '35357',
'auth_protocol': 'http',
Expand Down Expand Up @@ -1182,6 +1186,7 @@ def test_identity_service_context_with_data_https(self, *args):
'admin_tenant_id': None,
'admin_domain_id': None,
'admin_user': 'adam',
'admin_user_id': None,
'auth_host': 'keystone-host.local',
'auth_port': '35357',
'auth_protocol': 'https',
Expand Down Expand Up @@ -1216,6 +1221,7 @@ def test_identity_service_context_with_data_versioned(self, *args):
'service_project_id': 'svc-proj-id',
'service_domain_id': 'svc-dom-id',
'admin_user': 'adam',
'admin_user_id': None,
'auth_host': 'keystone-host.local',
'auth_port': '35357',
'auth_protocol': 'https',
Expand Down Expand Up @@ -1247,6 +1253,7 @@ def test_identity_service_context_with_admin_role(self, *args):
'admin_tenant_id': None,
'admin_domain_id': None,
'admin_user': 'adam',
'admin_user_id': None,
'auth_host': 'keystone-host.local',
'auth_port': '35357',
'auth_protocol': 'https',
Expand Down Expand Up @@ -1303,6 +1310,7 @@ def test_identity_service_context_with_ipv6(self, format_ipv6_addr, *args):
'admin_tenant_id': '123456',
'admin_domain_id': None,
'admin_user': 'adam',
'admin_user_id': None,
'auth_host': '[2001:db8:1::1]',
'auth_port': '35357',
'auth_protocol': 'http',
Expand Down

0 comments on commit 4669229

Please sign in to comment.