Merge "policy.json: Allow one to manage them from the puppet module"
This commit is contained in:
commit
d2615c9e0a
@ -69,13 +69,16 @@ class ceilometer::api (
|
||||
) {
|
||||
|
||||
include ceilometer::params
|
||||
include ceilometer::policy
|
||||
|
||||
validate_string($keystone_password)
|
||||
|
||||
Ceilometer_config<||> ~> Service['ceilometer-api']
|
||||
Class['ceilometer::policy'] ~> Service['ceilometer-api']
|
||||
|
||||
Package['ceilometer-api'] -> Ceilometer_config<||>
|
||||
Package['ceilometer-api'] -> Service['ceilometer-api']
|
||||
Package['ceilometer-api'] -> Class['ceilometer::policy']
|
||||
package { 'ceilometer-api':
|
||||
ensure => $package_ensure,
|
||||
name => $::ceilometer::params::api_package_name,
|
||||
|
28
manifests/policy.pp
Normal file
28
manifests/policy.pp
Normal file
@ -0,0 +1,28 @@
|
||||
# == Class: ceilometer::policy
|
||||
#
|
||||
# Configure the ceilometer policies
|
||||
#
|
||||
# === Parameters
|
||||
#
|
||||
# [*policies*]
|
||||
# (optional) Set of policies to configure for ceilometer
|
||||
# Example : { 'ceilometer-context_is_admin' => {'context_is_admin' => 'true'}, 'ceilometer-default' => {'default' => 'rule:admin_or_owner'} }
|
||||
# Defaults to empty hash.
|
||||
#
|
||||
# [*policy_path*]
|
||||
# (optional) Path to the ceilometer policy.json file
|
||||
# Defaults to /etc/ceilometer/policy.json
|
||||
#
|
||||
class ceilometer::policy (
|
||||
$policies = {},
|
||||
$policy_path = '/etc/ceilometer/policy.json',
|
||||
) {
|
||||
|
||||
Openstacklib::Policy::Base {
|
||||
file_path => $policy_path,
|
||||
}
|
||||
class { 'openstacklib::policy' :
|
||||
policies => $policies,
|
||||
}
|
||||
|
||||
}
|
@ -29,6 +29,7 @@ describe 'ceilometer::api' do
|
||||
end
|
||||
|
||||
it { should contain_class('ceilometer::params') }
|
||||
it { should contain_class('ceilometer::policy') }
|
||||
|
||||
it 'installs ceilometer-api package' do
|
||||
should contain_package('ceilometer-api').with(
|
||||
|
40
spec/classes/ceilometer_policy_spec.rb
Normal file
40
spec/classes/ceilometer_policy_spec.rb
Normal file
@ -0,0 +1,40 @@
|
||||
require 'spec_helper'
|
||||
|
||||
describe 'ceilometer::policy' do
|
||||
|
||||
shared_examples_for 'ceilometer policies' do
|
||||
let :params do
|
||||
{
|
||||
:policy_path => '/etc/ceilometer/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 'ceilometer policies'
|
||||
end
|
||||
|
||||
context 'on RedHat platforms' do
|
||||
let :facts do
|
||||
{ :osfamily => 'RedHat' }
|
||||
end
|
||||
|
||||
it_configures 'ceilometer policies'
|
||||
end
|
||||
end
|
Loading…
x
Reference in New Issue
Block a user