Browse Source

Merge "Add support for oslo_policy/enforce_new_defaults"

changes/71/783171/2
Zuul 4 months ago
committed by Gerrit Code Review
parent
commit
dae4e123f4
  1. 17
      manifests/policy.pp
  2. 5
      releasenotes/notes/policy-enforce_new_defaults-239a805a6d0fba80.yaml
  3. 12
      spec/classes/glance_policy_spec.rb

17
manifests/policy.pp

@ -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 glance
# Example :
@ -28,9 +33,10 @@
# Defaults to /etc/glance/policy.yaml
#
class glance::policy (
$enforce_scope = $::os_service_default,
$policies = {},
$policy_path = '/etc/glance/policy.yaml',
$enforce_scope = $::os_service_default,
$enforce_new_defaults = $::os_service_default,
$policies = {},
$policy_path = '/etc/glance/policy.yaml',
) {
include glance::deps
@ -48,8 +54,9 @@ class glance::policy (
create_resources('openstacklib::policy::base', $policies)
oslo::policy { 'glance_api_config':
enforce_scope => $enforce_scope,
policy_file => $policy_path
enforce_scope => $enforce_scope,
enforce_new_defaults => $enforce_new_defaults,
policy_file => $policy_path
}
}

5
releasenotes/notes/policy-enforce_new_defaults-239a805a6d0fba80.yaml

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

12
spec/classes/glance_policy_spec.rb

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

Loading…
Cancel
Save