Fix Designate for use with oslo.context>=4.0.0

This patch updates Designate to be compatible with oslo.context>=4.0.0.
Oslo.context has removed support for "tenant" in the context.

Change-Id: I49ed7df40bdd2dfbdc4b21817b23e4e21c8ce400
This commit is contained in:
Michael Johnson 2022-02-28 23:22:12 +00:00
parent 694d189f36
commit 8ce022a7b9
2 changed files with 8 additions and 2 deletions

View File

@ -77,7 +77,7 @@ RULE_ZONE_TRANSFER = (
RULE_ADMIN = 'rule:admin'
RULE_ADMIN_OR_OWNER = 'rule:admin_or_owner'
LEGACY_RULE_ZONE_TRANSFER = "rule:admin_or_owner OR " \
"tenant:%(target_tenant_id)s " \
"project_id:%(target_tenant_id)s " \
"OR None:%(target_tenant_id)s"
deprecated_default = policy.DeprecatedRule(
@ -95,7 +95,7 @@ rules = [
# TODO(johnsom) remove when the deprecated RBAC rules are removed.
policy.RuleDefault(
name="owner",
check_str="tenant:%(tenant_id)s"),
check_str="project_id:%(tenant_id)s"),
# TODO(johnsom) remove when the deprecated RBAC rules are removed.
policy.RuleDefault(
name="admin_or_owner",

View File

@ -76,7 +76,10 @@ class DesignateContext(context.RequestContext):
user_idt = (
self.user_idt_format.format(
user=user,
# TODO(johnsom) Remove tenant once oslo.context>=4.0.0 is
# the lower bound version.
tenant=self.project_id or '-',
project_id=self.project_id or '-',
domain=self.domain_id or '-',
user_domain=self.user_domain_id or '-',
p_domain=self.project_domain_id or '-')
@ -84,6 +87,9 @@ class DesignateContext(context.RequestContext):
# Update the dict with Designate specific extensions and overrides
d.update({
# TODO(johnsom) Remove project_id once oslo.context>=4.0.0 is
# the lower bound version.
'project_id': self.project_id,
'user_identity': user_idt,
'original_project_id': self.original_project_id,
'service_catalog': self.service_catalog,