Switch oslo.policy over to yaml

Upstream switched oslo.policy from JSON to YAML format
output in [1].

[1] https://review.opendev.org/#/c/732453/

Closes-Bug: #1885602

Depends-On: Iec610053a9250cb78c2a17bfc2c197bf55d9df86
Change-Id: Ieb6bc60eb2750a9f3f0539c2bd0176fabfebb30e
This commit is contained in:
Carlos Goncalves 2020-06-29 20:43:33 +02:00 committed by Brent Eagles
parent 20493bf5c0
commit daa3c1269f
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