Add support for oslo_policy/enforce_new_defaults

Depends-on: https://review.opendev.org/781428
Change-Id: Ic012fdd97529baebef8840f364084e7f946b6908
This commit is contained in:
Takashi Kajinami 2021-03-24 16:38:22 +09:00
parent e08f3cd6fe
commit 704c10fce4
3 changed files with 24 additions and 10 deletions

View File

@ -8,6 +8,11 @@
# (Optional) Whether or not to enforce scope when evaluating policies. # (Optional) Whether or not to enforce scope when evaluating policies.
# Defaults to $::os_service_default. # Defaults to $::os_service_default.
# #
# [*enforce_new_defaults*]
# (Optional) Whether or not to use old deprecated defaults when evaluating
# policies.
# Defaults to $::os_service_default.
#
# [*policies*] # [*policies*]
# (Optional) Set of policies to configure for heat # (Optional) Set of policies to configure for heat
# Example : # Example :
@ -29,6 +34,7 @@
# #
class heat::policy ( class heat::policy (
$enforce_scope = $::os_service_default, $enforce_scope = $::os_service_default,
$enforce_new_defaults = $::os_service_default,
$policies = {}, $policies = {},
$policy_path = '/etc/heat/policy.yaml', $policy_path = '/etc/heat/policy.yaml',
) { ) {
@ -49,6 +55,7 @@ class heat::policy (
oslo::policy { 'heat_config': oslo::policy { 'heat_config':
enforce_scope => $enforce_scope, enforce_scope => $enforce_scope,
enforce_new_defaults => $enforce_new_defaults,
policy_file => $policy_path policy_file => $policy_path
} }

View File

@ -0,0 +1,5 @@
---
features:
- |
The new ``heat::policy::enforce_new_defaults`` parameter has been
added.

View File

@ -5,6 +5,7 @@ describe 'heat::policy' do
let :params do let :params do
{ {
:enforce_scope => false, :enforce_scope => false,
:enforce_new_defaults => false,
:policy_path => '/etc/heat/policy.yaml', :policy_path => '/etc/heat/policy.yaml',
:policies => { :policies => {
'context_is_admin' => { 'context_is_admin' => {
@ -25,6 +26,7 @@ describe 'heat::policy' do
}) })
is_expected.to contain_oslo__policy('heat_config').with( is_expected.to contain_oslo__policy('heat_config').with(
:enforce_scope => false, :enforce_scope => false,
:enforce_new_defaults => false,
:policy_file => '/etc/heat/policy.yaml', :policy_file => '/etc/heat/policy.yaml',
) )
end end