Add group to policy management

The move of policy.json into code means the file may not exist. We've
added support to ensure that the file exists in the openstacklib but we
need to make sure the permissions are right for each service. This adds
the group information to the policies so it works right.

Depends-On: I26e8b1384f4f69712da9d06a4c565dfd1f17c9ed
Change-Id: Ie828ad4859dc901926b1420dcfc305b243c93904
Co-Authored-By: Alex Schultz <aschultz@redhat.com>
This commit is contained in:
Emilien Macchi 2018-01-10 14:09:56 -08:00
parent d57358693c
commit 40de925e9e
3 changed files with 22 additions and 4 deletions

View File

@ -11,6 +11,7 @@ class murano::params {
# service names # service names
$api_service_name = 'murano-api' $api_service_name = 'murano-api'
$engine_service_name = 'murano-engine' $engine_service_name = 'murano-engine'
$group = 'murano'
case $::osfamily { case $::osfamily {
'RedHat': { 'RedHat': {

View File

@ -6,6 +6,17 @@
# #
# [*policies*] # [*policies*]
# (optional) Set of policies to configure for murano # (optional) Set of policies to configure for murano
# Example :
# {
# 'murano-context_is_admin' => {
# 'key' => 'context_is_admin',
# 'value' => 'true'
# },
# 'murano-default' => {
# 'key' => 'default',
# 'value' => 'rule:admin_or_owner'
# }
# }
# Defaults to empty hash. # Defaults to empty hash.
# #
# [*policy_path*] # [*policy_path*]
@ -18,13 +29,18 @@ class murano::policy (
) { ) {
include ::murano::deps include ::murano::deps
include ::murano::params
validate_hash($policies) validate_hash($policies)
Openstacklib::Policy::Base { Openstacklib::Policy::Base {
file_path => $policy_path, file_path => $policy_path,
file_user => 'root',
file_group => $::murano::params::group,
} }
create_resources('openstacklib::policy::base', $policies) create_resources('openstacklib::policy::base', $policies)
oslo::policy { 'murano_config': policy_file => $policy_path } oslo::policy { 'murano_config': policy_file => $policy_path }
} }

View File

@ -17,8 +17,10 @@ describe 'murano::policy' do
it 'set up the policies' do it 'set up the policies' do
is_expected.to contain_openstacklib__policy__base('context_is_admin').with({ is_expected.to contain_openstacklib__policy__base('context_is_admin').with({
:key => 'context_is_admin', :key => 'context_is_admin',
:value => 'foo:bar' :value => 'foo:bar',
:file_user => 'root',
:file_group => 'murano',
}) })
is_expected.to contain_oslo__policy('murano_config').with( is_expected.to contain_oslo__policy('murano_config').with(
:policy_file => '/etc/murano/policy.json', :policy_file => '/etc/murano/policy.json',
@ -37,5 +39,4 @@ describe 'murano::policy' do
it_configures 'murano policies' it_configures 'murano policies'
end end
end end
end end