Add deprecation notices to deprecated policy rules

Their deprecation is mentioned in the release notes, but we should
make sure the notices also appear in the generated policy.yaml.sample
file.

Change-Id: I1b024fe87037bdad43080201054f6808604e3431
This commit is contained in:
Brian Rosmaita 2021-09-17 15:15:25 -04:00
parent c8453e4480
commit dc16eb0750

View File

@ -289,19 +289,23 @@ SYSTEM_OR_DOMAIN_OR_PROJECT_ADMIN = 'rule:system_or_domain_or_project_admin'
SYSTEM_ADMIN = _SYSTEM_ADMIN
YOGA_REMOVAL = 'DEPRECATED: This rule will be removed in the Yoga release.'
PADDING = ' ' * (70 - len(YOGA_REMOVAL))
# legacy rules to be removed in Yoga
legacy_rule_defaults = [
policy.RuleDefault('admin_or_owner',
'is_admin:True or (role:admin and '
'is_admin_project:True) or project_id:%(project_id)s',
description="Default rule for most non-Admin APIs."),
description=(f'{YOGA_REMOVAL}{PADDING}'
'Default rule for most non-Admin APIs.')),
# currently used only by cinder.policies.default_types
policy.RuleDefault('system_or_domain_or_project_admin',
'(role:admin and system_scope:all) or '
'(role:admin and domain_id:%(domain_id)s) or '
'(role:admin and project_id:%(project_id)s)',
description="Default rule for admins of cloud, domain "
"or a project."),
description=(f'{YOGA_REMOVAL}{PADDING}'
"Default rule for admins of cloud, domain "
"or a project.")),
]