From 8b7287cfabebb5aee6e5007c82ac37e3155c0d47 Mon Sep 17 00:00:00 2001 From: Takashi Kajinami Date: Wed, 24 Mar 2021 18:28:47 +0900 Subject: [PATCH] Add support for oslo_policy/enforce_new_defaults Depends-on: https://review.opendev.org/781428 Change-Id: Iface46d749bc237e1df2eaa3ed47c0b2211eacbf --- manifests/policy.pp | 17 ++++++++++++----- ...y-enforce_new_defaults-233f12d142ffd054.yaml | 5 +++++ spec/classes/zaqar_policy_spec.rb | 12 +++++++----- 3 files changed, 24 insertions(+), 10 deletions(-) create mode 100644 releasenotes/notes/policy-enforce_new_defaults-233f12d142ffd054.yaml diff --git a/manifests/policy.pp b/manifests/policy.pp index e42a496..4d10fc6 100644 --- a/manifests/policy.pp +++ b/manifests/policy.pp @@ -8,6 +8,11 @@ # (Optional) Whether or not to enforce scope when evaluating policies. # 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*] # (Optional) Set of policies to configure for zaqar # Example : @@ -28,9 +33,10 @@ # Defaults to /etc/zaqar/policy.yaml # class zaqar::policy ( - $enforce_scope = $::os_service_default, - $policies = {}, - $policy_path = '/etc/zaqar/policy.yaml', + $enforce_scope = $::os_service_default, + $enforce_new_defaults = $::os_service_default, + $policies = {}, + $policy_path = '/etc/zaqar/policy.yaml', ) { include zaqar::deps @@ -48,8 +54,9 @@ class zaqar::policy ( create_resources('openstacklib::policy::base', $policies) oslo::policy { 'zaqar_config': - enforce_scope => $enforce_scope, - policy_file => $policy_path + enforce_scope => $enforce_scope, + enforce_new_defaults => $enforce_new_defaults, + policy_file => $policy_path } } diff --git a/releasenotes/notes/policy-enforce_new_defaults-233f12d142ffd054.yaml b/releasenotes/notes/policy-enforce_new_defaults-233f12d142ffd054.yaml new file mode 100644 index 0000000..d03a8d7 --- /dev/null +++ b/releasenotes/notes/policy-enforce_new_defaults-233f12d142ffd054.yaml @@ -0,0 +1,5 @@ +--- +features: + - | + The new ``zaqar::policy::enforce_new_defaults`` parameter has been + added. diff --git a/spec/classes/zaqar_policy_spec.rb b/spec/classes/zaqar_policy_spec.rb index 330d0f1..dfd782c 100644 --- a/spec/classes/zaqar_policy_spec.rb +++ b/spec/classes/zaqar_policy_spec.rb @@ -4,9 +4,10 @@ describe 'zaqar::policy' do shared_examples 'zaqar::policy' do let :params do { - :enforce_scope => false, - :policy_path => '/etc/zaqar/policy.yaml', - :policies => { + :enforce_scope => false, + :enforce_new_defaults => false, + :policy_path => '/etc/zaqar/policy.yaml', + :policies => { 'context_is_admin' => { 'key' => 'context_is_admin', 'value' => 'foo:bar' @@ -24,8 +25,9 @@ describe 'zaqar::policy' do :file_format => 'yaml', }) is_expected.to contain_oslo__policy('zaqar_config').with( - :enforce_scope => false, - :policy_file => '/etc/zaqar/policy.yaml', + :enforce_scope => false, + :enforce_new_defaults => false, + :policy_file => '/etc/zaqar/policy.yaml', ) end end