From f21b7007d03023b6367ebf61f003fa7d3f73ea2d Mon Sep 17 00:00:00 2001 From: Takashi Kajinami Date: Thu, 22 Apr 2021 11:57:19 +0900 Subject: [PATCH] Add support for oslo_policy/policy_dirs Change-Id: I9ddd46e3b6f2dc9abd36ad7e821e6598ab71689c --- puppet-{{cookiecutter.project_name}}/manifests/policy.pp | 8 +++++++- .../classes/{{cookiecutter.project_name}}_policy_spec.rb | 2 ++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/puppet-{{cookiecutter.project_name}}/manifests/policy.pp b/puppet-{{cookiecutter.project_name}}/manifests/policy.pp index 221beab..6a62730 100644 --- a/puppet-{{cookiecutter.project_name}}/manifests/policy.pp +++ b/puppet-{{cookiecutter.project_name}}/manifests/policy.pp @@ -32,11 +32,16 @@ # (Optional) Path to the {{cookiecutter.project_name}} policy.yaml file # Defaults to /etc/{{cookiecutter.project_name}}/policy.yaml # +# [*policy_dirs*] +# (Optional) Path to the {{cookiecutter.project_name}} policy folder +# Defaults to $::os_service_default +# class {{cookiecutter.project_name}}::policy ( $enforce_scope = $::os_service_default, $enforce_new_defaults = $::os_service_default, $policies = {}, $policy_path = '/etc/{{cookiecutter.project_name}}/policy.yaml', + $policy_dirs = $::os_service_default, ) { include {{cookiecutter.project_name}}::deps @@ -56,7 +61,8 @@ class {{cookiecutter.project_name}}::policy ( oslo::policy { '{{cookiecutter.project_name}}_config': enforce_scope => $enforce_scope, enforce_new_defaults => $enforce_new_defaults, - policy_file => $policy_path + policy_file => $policy_path, + policy_dirs => $policy_dirs, } } diff --git a/puppet-{{cookiecutter.project_name}}/spec/classes/{{cookiecutter.project_name}}_policy_spec.rb b/puppet-{{cookiecutter.project_name}}/spec/classes/{{cookiecutter.project_name}}_policy_spec.rb index 3eca0c1..507a44b 100644 --- a/puppet-{{cookiecutter.project_name}}/spec/classes/{{cookiecutter.project_name}}_policy_spec.rb +++ b/puppet-{{cookiecutter.project_name}}/spec/classes/{{cookiecutter.project_name}}_policy_spec.rb @@ -7,6 +7,7 @@ describe '{{cookiecutter.project_name}}::policy' do :enforce_scope => false, :enforce_new_defaults => false, :policy_path => '/etc/{{cookiecutter.project_name}}/policy.yaml', + :policy_dirs => '/etc/{{cookiecutter.project_name}}/policy.d', :policies => { 'context_is_admin' => { 'key' => 'context_is_admin', @@ -28,6 +29,7 @@ describe '{{cookiecutter.project_name}}::policy' do :enforce_scope => false, :enforce_new_defaults => false, :policy_file => '/etc/{{cookiecutter.project_name}}/policy.yaml', + :policy_dirs => '/etc/{{cookiecutter.project_name}}/policy.d', ) end end