Add support for the oslo_policy/enforce_scope parameter
Depends-on: https://review.opendev.org/#/c/759008/ Change-Id: I1c92094c34baa4a30d10f30e6c2d613030ba93a2
This commit is contained in:
parent
a75c239a8f
commit
18c70a3a69
|
@ -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 glare
|
||||
# Example :
|
||||
|
@ -20,12 +24,13 @@
|
|||
# Defaults to empty hash.
|
||||
#
|
||||
# [*policy_path*]
|
||||
# (Optional) Path to the nova policy.yaml file
|
||||
# (Optional) Path to the glare policy.yaml file
|
||||
# Defaults to /etc/glare/policy.yaml
|
||||
#
|
||||
class glare::policy (
|
||||
$policies = {},
|
||||
$policy_path = '/etc/glare/policy.yaml',
|
||||
$enforce_scope = $::os_service_default,
|
||||
$policies = {},
|
||||
$policy_path = '/etc/glare/policy.yaml',
|
||||
) {
|
||||
|
||||
include glare::deps
|
||||
|
@ -42,6 +47,9 @@ class glare::policy (
|
|||
|
||||
create_resources('openstacklib::policy::base', $policies)
|
||||
|
||||
oslo::policy { 'glare_config': policy_file => $policy_path }
|
||||
oslo::policy { 'glare_config':
|
||||
enforce_scope => $enforce_scope,
|
||||
policy_file => $policy_path
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -0,0 +1,5 @@
|
|||
---
|
||||
features:
|
||||
- |
|
||||
The new ``glare::policy::enforce_scope`` parameter has been added to
|
||||
support the corresponding parameter in oslo.policy library.
|
|
@ -1,12 +1,12 @@
|
|||
require 'spec_helper'
|
||||
|
||||
describe 'glare::policy' do
|
||||
|
||||
shared_examples_for 'glare policies' do
|
||||
shared_examples 'glare::policy' do
|
||||
let :params do
|
||||
{
|
||||
:policy_path => '/etc/glare/policy.yaml',
|
||||
:policies => {
|
||||
:enforce_scope => false,
|
||||
:policy_path => '/etc/glare/policy.yaml',
|
||||
:policies => {
|
||||
'context_is_admin' => {
|
||||
'key' => 'context_is_admin',
|
||||
'value' => 'foo:bar'
|
||||
|
@ -24,20 +24,21 @@ describe 'glare::policy' do
|
|||
:file_format => 'yaml',
|
||||
})
|
||||
is_expected.to contain_oslo__policy('glare_config').with(
|
||||
:policy_file => '/etc/glare/policy.yaml',
|
||||
:enforce_scope => false,
|
||||
:policy_file => '/etc/glare/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 'glare policies'
|
||||
it_behaves_like 'glare::policy'
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue