From 035c0bb808c6bade9fb2e8fa717657e8e897e251 Mon Sep 17 00:00:00 2001 From: Emilien Macchi Date: Wed, 10 Jan 2018 14:07:44 -0800 Subject: [PATCH] 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 --- manifests/params.pp | 1 + manifests/policy.pp | 5 ++++- spec/classes/barbican_policy_spec.rb | 26 ++++---------------------- 3 files changed, 9 insertions(+), 23 deletions(-) diff --git a/manifests/params.pp b/manifests/params.pp index 7dc418ef..59d1b6b5 100644 --- a/manifests/params.pp +++ b/manifests/params.pp @@ -6,6 +6,7 @@ class barbican::params { include ::openstacklib::defaults $client_package_name = 'python-barbicanclient' + $group = 'barbican' $dogtag_client_package = 'pki-base' case $::osfamily { diff --git a/manifests/policy.pp b/manifests/policy.pp index d358a745..bec287c2 100644 --- a/manifests/policy.pp +++ b/manifests/policy.pp @@ -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) diff --git a/spec/classes/barbican_policy_spec.rb b/spec/classes/barbican_policy_spec.rb index 321e726e..bd1f7824 100644 --- a/spec/classes/barbican_policy_spec.rb +++ b/spec/classes/barbican_policy_spec.rb @@ -1,22 +1,3 @@ -# -# Copyright (C) 2016 Red Hat Inc. -# -# Author: Ade Lee -# -# 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