Merge "Use yaml instead of json for policy file"

This commit is contained in:
Zuul 2021-01-14 21:36:01 +00:00 committed by Gerrit Code Review
commit afbb8f5d23
3 changed files with 18 additions and 12 deletions

@ -20,12 +20,12 @@
# Defaults to empty hash.
#
# [*policy_path*]
# (Optional) Path to the neutron policy.json file
# Defaults to /etc/neutron/policy.json
# (Optional) Path to the neutron policy.yaml file
# Defaults to /etc/neutron/policy.yaml
#
class neutron::policy (
$policies = {},
$policy_path = '/etc/neutron/policy.json',
$policy_path = '/etc/neutron/policy.yaml',
) {
include neutron::deps
@ -34,9 +34,10 @@ class neutron::policy (
validate_legacy(Hash, 'validate_hash', $policies)
Openstacklib::Policy::Base {
file_path => $policy_path,
file_user => 'root',
file_group => $::neutron::params::group,
file_path => $policy_path,
file_user => 'root',
file_group => $::neutron::params::group,
file_format => 'yaml',
}
create_resources('openstacklib::policy::base', $policies)

@ -0,0 +1,4 @@
---
upgrade:
- |
Now policy.yaml is used by default instead of policy.json.

@ -4,7 +4,7 @@ describe 'neutron::policy' do
shared_examples 'neutron policies' do
let :params do
{
:policy_path => '/etc/neutron/policy.json',
:policy_path => '/etc/neutron/policy.yaml',
:policies => {
'context_is_admin' => {
'key' => 'context_is_admin',
@ -16,13 +16,14 @@ describe 'neutron::policy' do
it 'set up the policies' do
should contain_openstacklib__policy__base('context_is_admin').with({
:key => 'context_is_admin',
:value => 'foo:bar',
:file_user => 'root',
:file_group => 'neutron',
:key => 'context_is_admin',
:value => 'foo:bar',
:file_user => 'root',
:file_group => 'neutron',
:file_format => 'yaml',
})
should contain_oslo__policy('neutron_config').with(
:policy_file => '/etc/neutron/policy.json',
:policy_file => '/etc/neutron/policy.yaml',
)
end
end