Use yaml instead of json for policy file

Because usage of json for policy file will be deprecated and replaced
by yaml[1].

[1] https://governance.openstack.org/tc/goals/selected/wallaby/migrate-policy-format-from-json-to-yaml.html

Depends-on: https://review.opendev.org/769647
Change-Id: Iacc5d630027d1fd3c5e052dff0021f79f95647d9
This commit is contained in:
Takashi Kajinami 2020-12-29 16:24:00 +09:00
parent c87498ac3b
commit 69b7ba8c47
3 changed files with 18 additions and 12 deletions

View File

@ -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
@ -37,6 +37,7 @@ class neutron::policy (
file_path => $policy_path,
file_user => 'root',
file_group => $::neutron::params::group,
file_format => 'yaml',
}
create_resources('openstacklib::policy::base', $policies)

View File

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

View File

@ -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',
@ -20,9 +20,10 @@ describe 'neutron::policy' do
: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