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
This commit is contained in:
deepak_mourya 2018-01-12 10:19:30 +05:30 committed by Emilien Macchi
parent 5a806e9030
commit 99c66833a5
3 changed files with 9 additions and 18 deletions

View File

@ -4,7 +4,7 @@
# should be considered to be constant
class nova::params {
include ::openstacklib::defaults
$group = 'nova'
case $::osfamily {
'RedHat': {
# package names

View File

@ -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)

View File

@ -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',