diff --git a/manifests/policy.pp b/manifests/policy.pp index f68c195..11fcec1 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 watcher # Example : @@ -28,9 +33,10 @@ # Defaults to /etc/watcher/policy.yaml # class watcher::policy ( - $enforce_scope = $::os_service_default, - $policies = {}, - $policy_path = '/etc/watcher/policy.yaml', + $enforce_scope = $::os_service_default, + $enforce_new_defaults = $::os_service_default, + $policies = {}, + $policy_path = '/etc/watcher/policy.yaml', ) { include watcher::deps @@ -48,8 +54,9 @@ class watcher::policy ( create_resources('openstacklib::policy::base', $policies) oslo::policy { 'watcher_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-985d95217cd2e7df.yaml b/releasenotes/notes/policy-enforce_new_defaults-985d95217cd2e7df.yaml new file mode 100644 index 0000000..077b379 --- /dev/null +++ b/releasenotes/notes/policy-enforce_new_defaults-985d95217cd2e7df.yaml @@ -0,0 +1,5 @@ +--- +features: + - | + The new ``watcher::policy::enforce_new_defaults`` parameter has been + added. diff --git a/spec/classes/watcher_policy_spec.rb b/spec/classes/watcher_policy_spec.rb index 6ff535a..a44afe3 100644 --- a/spec/classes/watcher_policy_spec.rb +++ b/spec/classes/watcher_policy_spec.rb @@ -4,9 +4,10 @@ describe 'watcher::policy' do shared_examples 'watcher::policy' do let :params do { - :enforce_scope => false, - :policy_path => '/etc/watcher/policy.yaml', - :policies => { + :enforce_scope => false, + :enforce_new_defaults => false, + :policy_path => '/etc/watcher/policy.yaml', + :policies => { 'context_is_admin' => { 'key' => 'context_is_admin', 'value' => 'foo:bar' @@ -24,8 +25,9 @@ describe 'watcher::policy' do :file_format => 'yaml', }) is_expected.to contain_oslo__policy('watcher_config').with( - :enforce_scope => false, - :policy_file => '/etc/watcher/policy.yaml', + :enforce_scope => false, + :enforce_new_defaults => false, + :policy_file => '/etc/watcher/policy.yaml', ) end end