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: I9f0aed7d3f2945a4e5195dbf0a3b122acb039a19
Co-Authored-By: Alex Schultz <aschultz@redhat.com>
This commit is contained in:
Emilien Macchi 2018-01-10 14:07:44 -08:00
parent 4c076ebb47
commit 035c0bb808
3 changed files with 9 additions and 23 deletions

View File

@ -6,6 +6,7 @@ class barbican::params {
include ::openstacklib::defaults
$client_package_name = 'python-barbicanclient'
$group = 'barbican'
$dogtag_client_package = 'pki-base'
case $::osfamily {

View File

@ -29,11 +29,14 @@ class barbican::policy (
) {
include ::barbican::deps
include ::barbican::params
validate_hash($policies)
Openstacklib::Policy::Base {
file_path => $policy_path,
file_path => $policy_path,
file_user => 'root',
file_group => $::barbican::params::group,
}
create_resources('openstacklib::policy::base', $policies)

View File

@ -1,22 +1,3 @@
#
# Copyright (C) 2016 Red Hat Inc. <licensing@redhat.com>
#
# Author: Ade Lee <alee@redhat.com>
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
#
# Unit tests for barbican::policy class
#
require 'spec_helper'
describe 'barbican::policy' do
@ -36,8 +17,10 @@ describe 'barbican::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 => 'barbican',
})
is_expected.to contain_oslo__policy('barbican_config').with(
:policy_file => '/etc/barbican/policy.json',
@ -56,5 +39,4 @@ describe 'barbican::policy' do
it_configures 'barbican policies'
end
end
end