From 1feab68bfaa7d3a4f30fcf26db47354c19910c05 Mon Sep 17 00:00:00 2001 From: Takashi Kajinami Date: Tue, 29 Dec 2020 16:35:28 +0900 Subject: [PATCH] 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: I44aefbc366b549ad7ad73391a5d41cd151a66f62 --- manifests/policy.pp | 13 +++++++------ ...y-format-from-json-to-yaml-0d8f7c7ccc3715a1.yaml | 4 ++++ spec/classes/zaqar_policy_spec.rb | 13 +++++++------ 3 files changed, 18 insertions(+), 12 deletions(-) create mode 100644 releasenotes/notes/migrate-policy-format-from-json-to-yaml-0d8f7c7ccc3715a1.yaml diff --git a/manifests/policy.pp b/manifests/policy.pp index b8aaf2a..1f86e06 100644 --- a/manifests/policy.pp +++ b/manifests/policy.pp @@ -20,12 +20,12 @@ # Defaults to empty hash. # # [*policy_path*] -# (Optional) Path to the zaqar policy.json file -# Defaults to /etc/zaqar/policy.json +# (Optional) Path to the zaqar policy.yaml file +# Defaults to /etc/zaqar/policy.yaml # class zaqar::policy ( $policies = {}, - $policy_path = '/etc/zaqar/policy.json', + $policy_path = '/etc/zaqar/policy.yaml', ) { include zaqar::deps @@ -34,9 +34,10 @@ class zaqar::policy ( validate_legacy(Hash, 'validate_hash', $policies) Openstacklib::Policy::Base { - file_path => $policy_path, - file_user => 'root', - file_group => $::zaqar::params::group, + file_path => $policy_path, + file_user => 'root', + file_group => $::zaqar::params::group, + file_format => 'yaml', } create_resources('openstacklib::policy::base', $policies) diff --git a/releasenotes/notes/migrate-policy-format-from-json-to-yaml-0d8f7c7ccc3715a1.yaml b/releasenotes/notes/migrate-policy-format-from-json-to-yaml-0d8f7c7ccc3715a1.yaml new file mode 100644 index 0000000..fd7e1a8 --- /dev/null +++ b/releasenotes/notes/migrate-policy-format-from-json-to-yaml-0d8f7c7ccc3715a1.yaml @@ -0,0 +1,4 @@ +--- +upgrade: + - | + Now policy.yaml is used by default instead of policy.json. diff --git a/spec/classes/zaqar_policy_spec.rb b/spec/classes/zaqar_policy_spec.rb index 2f110bb..634ce5e 100644 --- a/spec/classes/zaqar_policy_spec.rb +++ b/spec/classes/zaqar_policy_spec.rb @@ -5,7 +5,7 @@ describe 'zaqar::policy' do shared_examples_for 'zaqar policies' do let :params do { - :policy_path => '/etc/zaqar/policy.json', + :policy_path => '/etc/zaqar/policy.yaml', :policies => { 'context_is_admin' => { 'key' => 'context_is_admin', @@ -17,13 +17,14 @@ describe 'zaqar::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 => 'zaqar', + :key => 'context_is_admin', + :value => 'foo:bar', + :file_user => 'root', + :file_group => 'zaqar', + :file_format => 'yaml', }) is_expected.to contain_oslo__policy('zaqar_config').with( - :policy_file => '/etc/zaqar/policy.json', + :policy_file => '/etc/zaqar/policy.yaml', ) end end