Merge "policy.json: Allow one to manage them from the puppet module"
This commit is contained in:
commit
c79a2a2c3a
@ -106,11 +106,14 @@ class cinder::api (
|
||||
) {
|
||||
|
||||
include cinder::params
|
||||
include cinder::policy
|
||||
|
||||
Cinder_config<||> ~> Service['cinder-api']
|
||||
Cinder_api_paste_ini<||> ~> Service['cinder-api']
|
||||
Class['cinder::policy'] ~> Service['cinder-api']
|
||||
|
||||
if $::cinder::params::api_package {
|
||||
Package['cinder-api'] -> Class['cinder::policy']
|
||||
Package['cinder-api'] -> Cinder_config<||>
|
||||
Package['cinder-api'] -> Cinder_api_paste_ini<||>
|
||||
Package['cinder-api'] -> Service['cinder-api']
|
||||
|
28
manifests/policy.pp
Normal file
28
manifests/policy.pp
Normal file
@ -0,0 +1,28 @@
|
||||
# == Class: cinder::policy
|
||||
#
|
||||
# Configure the cinder policies
|
||||
#
|
||||
# === Parameters
|
||||
#
|
||||
# [*policies*]
|
||||
# (optional) Set of policies to configure for cinder
|
||||
# Example : { 'cinder-context_is_admin' => {'context_is_admin' => 'true'}, 'cinder-default' => {'default' => 'rule:admin_or_owner'} }
|
||||
# Defaults to empty hash.
|
||||
#
|
||||
# [*policy_path*]
|
||||
# (optional) Path to the cinder policy.json file
|
||||
# Defaults to /etc/cinder/policy.json
|
||||
#
|
||||
class cinder::policy (
|
||||
$policies = {},
|
||||
$policy_path = '/etc/cinder/policy.json',
|
||||
) {
|
||||
|
||||
Openstacklib::Policy::Base {
|
||||
file_path => $policy_path,
|
||||
}
|
||||
class { 'openstacklib::policy' :
|
||||
policies => $policies,
|
||||
}
|
||||
|
||||
}
|
40
spec/classes/cinder_policy_spec.rb
Normal file
40
spec/classes/cinder_policy_spec.rb
Normal file
@ -0,0 +1,40 @@
|
||||
require 'spec_helper'
|
||||
|
||||
describe 'cinder::policy' do
|
||||
|
||||
shared_examples_for 'cinder policies' do
|
||||
let :params do
|
||||
{
|
||||
:policy_path => '/etc/cinder/policy.json',
|
||||
:policies => {
|
||||
'context_is_admin' => {
|
||||
'key' => 'context_is_admin',
|
||||
'value' => 'foo:bar'
|
||||
}
|
||||
}
|
||||
}
|
||||
end
|
||||
|
||||
it 'set up the policies' do
|
||||
should contain_class('openstacklib::policy').with({
|
||||
:policies => params[:policies]
|
||||
})
|
||||
end
|
||||
end
|
||||
|
||||
context 'on Debian platforms' do
|
||||
let :facts do
|
||||
{ :osfamily => 'Debian' }
|
||||
end
|
||||
|
||||
it_configures 'cinder policies'
|
||||
end
|
||||
|
||||
context 'on RedHat platforms' do
|
||||
let :facts do
|
||||
{ :osfamily => 'RedHat' }
|
||||
end
|
||||
|
||||
it_configures 'cinder policies'
|
||||
end
|
||||
end
|
Loading…
x
Reference in New Issue
Block a user