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
Related-Bug: #1742154
Change-Id: I10b322d05042fdef23758d46906cf57aa9def97f
This commit is contained in:
Alex Schultz 2018-01-09 11:08:17 -07:00 committed by Emilien Macchi
parent d7796e934b
commit bdd660ccdb
3 changed files with 10 additions and 4 deletions

View File

@ -6,6 +6,7 @@ class zaqar::params {
include ::openstacklib::defaults
$client_package_name = 'python-zaqarclient'
$group = 'zaqar'
case $::osfamily {
'RedHat': {

View File

@ -20,7 +20,7 @@
# Defaults to empty hash.
#
# [*policy_path*]
# (optional) Path to the nova policy.json file
# (optional) Path to the zaqar policy.json file
# Defaults to /etc/zaqar/policy.json
#
class zaqar::policy (
@ -29,11 +29,14 @@ class zaqar::policy (
) {
include ::zaqar::deps
include ::zaqar::params
validate_hash($policies)
Openstacklib::Policy::Base {
file_path => $policy_path,
file_path => $policy_path,
file_user => 'root',
file_group => $::zaqar::params::group,
}
create_resources('openstacklib::policy::base', $policies)

View File

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