Browse Source

Merge "Use yaml instead of json for policy file"

changes/29/771329/1
Zuul 1 year ago committed by Gerrit Code Review
parent
commit
436eb6b29b
  1. 13
      manifests/policy.pp
  2. 4
      releasenotes/notes/migrate-policy-format-from-json-to-yaml-e9bccd13d354473a.yaml
  3. 13
      spec/classes/barbican_policy_spec.rb

13
manifests/policy.pp

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

4
releasenotes/notes/migrate-policy-format-from-json-to-yaml-e9bccd13d354473a.yaml

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

13
spec/classes/barbican_policy_spec.rb

@ -5,7 +5,7 @@ describe 'barbican::policy' do
shared_examples_for 'barbican policies' do
let :params do
{
:policy_path => '/etc/barbican/policy.json',
:policy_path => '/etc/barbican/policy.yaml',
:policies => {
'context_is_admin' => {
'key' => 'context_is_admin',
@ -17,13 +17,14 @@ describe 'barbican::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 => 'barbican',
:key => 'context_is_admin',
:value => 'foo:bar',
:file_user => 'root',
:file_group => 'barbican',
:file_format => 'yaml',
})
is_expected.to contain_oslo__policy('barbican_config').with(
:policy_file => '/etc/barbican/policy.json',
:policy_file => '/etc/barbican/policy.yaml',
)
end
end

Loading…
Cancel
Save