Browse Source

Add support for the oslo_policy/enforce_scope parameter

Depends-on: https://review.opendev.org/#/c/759008/
Change-Id: I07cb76f6a4db7ad77c54d6d54292d5f35e042d65
changes/87/780687/2
Takashi Kajinami 1 year ago
parent
commit
e5cbbe69e5
  1. 16
      manifests/policy.pp
  2. 5
      releasenotes/notes/oslo_policy-enforce_scope-935dc956f96c0edb.yaml
  3. 15
      spec/classes/barbican_policy_spec.rb

16
manifests/policy.pp

@ -4,6 +4,10 @@
#
# === Parameters
#
# [*enforce_scope*]
# (Optional) Whether or not to enforce scope when evaluating policies.
# Defaults to $::os_service_default.
#
# [*policies*]
# (Optional) Set of policies to configure for barbican
# Example :
@ -20,12 +24,13 @@
# Defaults to empty hash.
#
# [*policy_path*]
# (Optional) Path to the nova policy.yaml file
# (Optional) Path to the barbican policy.yaml file
# Defaults to /etc/barbican/policy.yaml
#
class barbican::policy (
$policies = {},
$policy_path = '/etc/barbican/policy.yaml',
$enforce_scope = $::os_service_default,
$policies = {},
$policy_path = '/etc/barbican/policy.yaml',
) {
include barbican::deps
@ -42,6 +47,9 @@ class barbican::policy (
create_resources('openstacklib::policy::base', $policies)
oslo::policy { 'barbican_config': policy_file => $policy_path }
oslo::policy { 'barbican_config':
enforce_scope => $enforce_scope,
policy_file => $policy_path
}
}

5
releasenotes/notes/oslo_policy-enforce_scope-935dc956f96c0edb.yaml

@ -0,0 +1,5 @@
---
features:
- |
The new ``barbican::policy::enforce_scope`` parameter has been added to
support the corresponding parameter in oslo.policy library.

15
spec/classes/barbican_policy_spec.rb

@ -1,12 +1,12 @@
require 'spec_helper'
describe 'barbican::policy' do
shared_examples_for 'barbican policies' do
shared_examples 'barbican::policy' do
let :params do
{
:policy_path => '/etc/barbican/policy.yaml',
:policies => {
:enforce_scope => false,
:policy_path => '/etc/barbican/policy.yaml',
:policies => {
'context_is_admin' => {
'key' => 'context_is_admin',
'value' => 'foo:bar'
@ -24,20 +24,21 @@ describe 'barbican::policy' do
:file_format => 'yaml',
})
is_expected.to contain_oslo__policy('barbican_config').with(
:policy_file => '/etc/barbican/policy.yaml',
:enforce_scope => false,
:policy_file => '/etc/barbican/policy.yaml',
)
end
end
on_supported_os({
:supported_os => OSDefaults.get_supported_os
:supported_os => OSDefaults.get_supported_os
}).each do |os,facts|
context "on #{os}" do
let (:facts) do
facts.merge!(OSDefaults.get_facts())
end
it_configures 'barbican policies'
it_behaves_like 'barbican::policy'
end
end
end

Loading…
Cancel
Save