Browse Source

Add support for oslo_policy/enforce_new_defaults

Depends-on: https://review.opendev.org/781428
Change-Id: I31b56add4e656930e6baf1dec235c31bb8572012
changes/54/782654/2
Takashi Kajinami 3 months ago
parent
commit
c574d4404e
3 changed files with 24 additions and 10 deletions
  1. +12
    -5
      manifests/policy.pp
  2. +5
    -0
      releasenotes/notes/policy-enforce_new_defaults-1e123af8357e4435.yaml
  3. +7
    -5
      spec/classes/neutron_policy_spec.rb

+ 12
- 5
manifests/policy.pp View File

@ -8,6 +8,11 @@
# (Optional) Whether or not to enforce scope when evaluating policies.
# Defaults to $::os_service_default.
#
# [*enforce_new_defaults*]
# (Optional) Whether or not to use old deprecated defaults when evaluating
# policies.
# Defaults to $::os_service_default.
#
# [*policies*]
# (Optional) Set of policies to configure for neutron
# Example :
@ -28,9 +33,10 @@
# Defaults to /etc/neutron/policy.yaml
#
class neutron::policy (
$enforce_scope = $::os_service_default,
$policies = {},
$policy_path = '/etc/neutron/policy.yaml',
$enforce_scope = $::os_service_default,
$enforce_new_defaults = $::os_service_default,
$policies = {},
$policy_path = '/etc/neutron/policy.yaml',
) {
include neutron::deps
@ -48,8 +54,9 @@ class neutron::policy (
create_resources('openstacklib::policy::base', $policies)
oslo::policy { 'neutron_config':
enforce_scope => $enforce_scope,
policy_file => $policy_path
enforce_scope => $enforce_scope,
enforce_new_defaults => $enforce_new_defaults,
policy_file => $policy_path
}
}

+ 5
- 0
releasenotes/notes/policy-enforce_new_defaults-1e123af8357e4435.yaml View File

@ -0,0 +1,5 @@
---
features:
- |
The new ``neutron::policy::enforce_new_defaults`` parameter has been
added.

+ 7
- 5
spec/classes/neutron_policy_spec.rb View File

@ -4,9 +4,10 @@ describe 'neutron::policy' do
shared_examples 'neutron::policy' do
let :params do
{
:enforce_scope => false,
:policy_path => '/etc/neutron/policy.yaml',
:policies => {
:enforce_scope => false,
:enforce_new_defaults => false,
:policy_path => '/etc/neutron/policy.yaml',
:policies => {
'context_is_admin' => {
'key' => 'context_is_admin',
'value' => 'foo:bar'
@ -24,8 +25,9 @@ describe 'neutron::policy' do
:file_format => 'yaml',
})
is_expected.to contain_oslo__policy('neutron_config').with(
:enforce_scope => false,
:policy_file => '/etc/neutron/policy.yaml',
:enforce_scope => false,
:enforce_new_defaults => false,
:policy_file => '/etc/neutron/policy.yaml',
)
end
end


Loading…
Cancel
Save