Add the capability to configure api-paste.ini with config.pp

Already added type/provider for paste configs,
but it wouldn't to patch ec2api::config.

Change-Id: Id1f9a537a73c9cb1d038ce9015bb5da76f827878
This commit is contained in:
ZhongShengping 2016-04-27 16:18:37 +08:00
parent a718515722
commit 02547a399c
2 changed files with 38 additions and 1 deletions

View File

@ -17,14 +17,20 @@
# DEFAULT/bar:
# value: barValue
#
# [*ec2api_api_paste_ini*]
# (optional) Allow configuration of /etc/ec2api/api-paste.ini options.
#
# NOTE: The configuration MUST NOT be already handled by this module
# or Puppet catalog compilation will fail with duplicate resources.
#
class ec2api::config (
$ec2api_config = {},
$ec2api_config = {},
$ec2api_api_paste_ini = {},
) {
validate_hash($ec2api_config)
validate_hash($ec2api_api_paste_ini)
create_resources('ec2api_config', $ec2api_config)
create_resources('ec2api_api_paste_ini', $ec2api_api_paste_ini)
}

View File

@ -0,0 +1,31 @@
require 'spec_helper'
describe 'ec2api::config' do
let :params do
{ :ec2api_config => {
'DEFAULT/foo' => { 'value' => 'fooValue' },
'DEFAULT/bar' => { 'value' => 'barValue' },
'DEFAULT/baz' => { 'ensure' => 'absent' }
},
:ec2api_api_paste_ini => {
'DEFAULT/foo2' => { 'value' => 'fooValue' },
'DEFAULT/bar2' => { 'value' => 'barValue' },
'DEFAULT/baz2' => { 'ensure' => 'absent' }
}
}
end
it 'configures arbitrary ec2api configurations' do
is_expected.to contain_ec2api_config('DEFAULT/foo').with_value('fooValue')
is_expected.to contain_ec2api_config('DEFAULT/bar').with_value('barValue')
is_expected.to contain_ec2api_config('DEFAULT/baz').with_ensure('absent')
end
it 'configures arbitrary ec2api-api-paste configurations' do
is_expected.to contain_ec2api_api_paste_ini('DEFAULT/foo2').with_value('fooValue')
is_expected.to contain_ec2api_api_paste_ini('DEFAULT/bar2').with_value('barValue')
is_expected.to contain_ec2api_api_paste_ini('DEFAULT/baz2').with_ensure('absent')
end
end