Skip to content

Commit 813e206

Browse files
committed
Fix certs ops as trustee for existing clusters
Change I249942a355577c4f1ef51b3988f0cc4979959d0b updated the domain_id field in context from domain_id to user_domain_id. Update the detection code here according. Without this, existing clusters will not be able to do some operations like resize. New clusters are OK because of the subsequent Change If5b31951959c7a141dc1cae5fefcabe4ebf438b3. [1] https://opendev.org/openstack/magnum/commit/5971243169c5df863ebe81cff7ebd07f190b840a#diff-145868d956788eb211486eb4de153c9db680ac16 Closes-Bug: #2076052 Change-Id: Ibefb9bc35c85e30d2e1ccff252217bb4905eb1af
1 parent 8d09169 commit 813e206

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

magnum/db/sqlalchemy/api.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -131,13 +131,16 @@ def _add_tenant_filters(self, context, query):
131131
kst = osc.keystone()
132132

133133
# User in a regular project (not in the trustee domain)
134-
if context.project_id and context.domain_id != kst.trustee_domain_id:
134+
if (
135+
context.project_id
136+
and context.user_domain_id != kst.trustee_domain_id
137+
):
135138
query = query.filter_by(project_id=context.project_id)
136139
# Match project ID component in trustee user's user name against
137140
# cluster's project_id to associate per-cluster trustee users who have
138141
# no project information with the project their clusters/cluster models
139142
# reside in. This is equivalent to the project filtering above.
140-
elif context.domain_id == kst.trustee_domain_id:
143+
elif context.user_domain_id == kst.trustee_domain_id:
141144
user_name = kst.client.users.get(context.user_id).name
142145
user_project = user_name.split('_', 2)[1]
143146
query = query.filter_by(project_id=user_project)

0 commit comments

Comments
 (0)