From 99c66833a54d381a8a8a7f94b921b4e9dfd11080 Mon Sep 17 00:00:00 2001 From: deepak_mourya Date: Fri, 12 Jan 2018 10:19:30 +0530 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: I2a18f8c3fa4969e083a95bff2b84e01b689b79a4 --- manifests/params.pp | 2 +- manifests/policy.pp | 19 ++++--------------- spec/classes/nova_policy_spec.rb | 6 ++++-- 3 files changed, 9 insertions(+), 18 deletions(-) diff --git a/manifests/params.pp b/manifests/params.pp index a7cf621cd..7af047aea 100644 --- a/manifests/params.pp +++ b/manifests/params.pp @@ -4,7 +4,7 @@ # should be considered to be constant class nova::params { include ::openstacklib::defaults - + $group = 'nova' case $::osfamily { 'RedHat': { # package names diff --git a/manifests/policy.pp b/manifests/policy.pp index a7488c72b..30f61674d 100644 --- a/manifests/policy.pp +++ b/manifests/policy.pp @@ -29,25 +29,14 @@ class nova::policy ( ) { include ::nova::deps + include ::nova::params validate_hash($policies) - # NOTE(danpawlik) Policy.json file has been removed in - # Ubuntu Cloud archive packages since Ocata staging. - # Ensure that the file exist. - file { '/etc/nova/policy.json': - ensure => file, - owner => 'nova', - group => 'nova', - mode => '0644', - require => Anchor['nova::install::end'], - before => Anchor['nova::config::begin'], - } - $policy_defaults = { - 'file_path' => $policy_path, - 'require' => Anchor['nova::config::begin'], - 'notify' => Anchor['nova::config::end'], + file_path => $policy_path, + file_user => 'root', + file_group => $::nova::params::group, } create_resources('openstacklib::policy::base', $policies, $policy_defaults) diff --git a/spec/classes/nova_policy_spec.rb b/spec/classes/nova_policy_spec.rb index 517ab20d8..5540b26a3 100644 --- a/spec/classes/nova_policy_spec.rb +++ b/spec/classes/nova_policy_spec.rb @@ -17,8 +17,10 @@ describe 'nova::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 => 'nova', }) is_expected.to contain_oslo__policy('nova_config').with( :policy_file => '/etc/nova/policy.json',