Merge "Add support for oslo_policy/enforce_new_defaults"

This commit is contained in:
Zuul 2021-03-27 02:11:02 +00:00 committed by Gerrit Code Review
commit ea466a9bb1
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 neutron # (Optional) Set of policies to configure for neutron
# Example : # Example :
@ -29,6 +34,7 @@
# #
class neutron::policy ( class neutron::policy (
$enforce_scope = $::os_service_default, $enforce_scope = $::os_service_default,
$enforce_new_defaults = $::os_service_default,
$policies = {}, $policies = {},
$policy_path = '/etc/neutron/policy.yaml', $policy_path = '/etc/neutron/policy.yaml',
) { ) {
@ -49,6 +55,7 @@ class neutron::policy (
oslo::policy { 'neutron_config': oslo::policy { 'neutron_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 ``neutron::policy::enforce_new_defaults`` parameter has been
added.

View File

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