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: I0826272ac4519fc7af3ed25344323966631ff980
This commit is contained in:
Takashi Kajinami 2020-12-29 16:53:04 +09:00
parent 403485cfb9
commit 89e8cb02e8
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 murano policy.json file
# Defaults to /etc/murano/policy.json
# (Optional) Path to the murano policy.yaml file
# Defaults to /etc/murano/policy.yaml
#
class murano::policy (
$policies = {},
$policy_path = '/etc/murano/policy.json',
$policy_path = '/etc/murano/policy.yaml',
) {
include murano::deps
@ -34,9 +34,10 @@ class murano::policy (
validate_legacy(Hash, 'validate_hash', $policies)
Openstacklib::Policy::Base {
file_path => $policy_path,
file_user => 'root',
file_group => $::murano::params::group,
file_path => $policy_path,
file_user => 'root',
file_group => $::murano::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

@ -5,7 +5,7 @@ describe 'murano::policy' do
shared_examples_for 'murano policies' do
let :params do
{
:policy_path => '/etc/murano/policy.json',
:policy_path => '/etc/murano/policy.yaml',
:policies => {
'context_is_admin' => {
'key' => 'context_is_admin',
@ -17,13 +17,14 @@ describe 'murano::policy' do
it 'set up the policies' do
is_expected.to contain_openstacklib__policy__base('context_is_admin').with({
:key => 'context_is_admin',
:value => 'foo:bar',
:file_user => 'root',
:file_group => 'murano',
:key => 'context_is_admin',
:value => 'foo:bar',
:file_user => 'root',
:file_group => 'murano',
:file_format => 'yaml',
})
is_expected.to contain_oslo__policy('murano_config').with(
:policy_file => '/etc/murano/policy.json',
:policy_file => '/etc/murano/policy.yaml',
)
end
end