Merge "Switch oslo.policy over to yaml"

This commit is contained in:
Zuul 2020-07-17 13:48:04 +00:00 committed by Gerrit Code Review
commit 51c88c5e60
3 changed files with 17 additions and 12 deletions

View File

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

View File

@ -0,0 +1,3 @@
---
fixes:
- Octavia switched oslo.policy from JSON to YAML format output.

View File

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