Customizable allowed_sync_hosts in container-server.conf

Insert default value into .conf file (127.0.0.1) or use
custom value if specified.

Change-Id: I9caec9657a2a3ad789b7dab646e505f609c25655
This commit is contained in:
Radim Kubacki 2013-05-21 14:11:34 +02:00
parent 4c990fd894
commit 3a0413f7f5
3 changed files with 36 additions and 2 deletions

View File

@ -1,5 +1,12 @@
#
# === Parameters
#
# [*allowed_sync_hosts*] A list of hosts allowed in the X-Container-Sync-To
# field for containers. Defaults to one entry list '127.0.0.1'.
#
class swift::storage::container(
$package_ensure = 'present'
$package_ensure = 'present',
$allowed_sync_hosts = ['127.0.0.1'],
) {
swift::storage::generic { 'container':
package_ensure => $package_ensure

View File

@ -60,7 +60,8 @@ describe 'swift::storage::container' do
let :facts do
{
:operatingsystem => 'RedHat',
:osfamily => 'RedHat'
:osfamily => 'RedHat',
:concat_basedir => '/var/lib/puppet/concat'
}
end
it 'should have some support services' do
@ -73,5 +74,30 @@ describe 'swift::storage::container' do
)
end
end
describe 'configuration file' do
let :pre_condition do
"class { 'ssh::server::install': }
class { 'swift': swift_hash_suffix => 'foo' }
class { 'swift::storage::all': storage_local_net_ip => '10.0.0.1' }"
end
let :fragment_file do
"/var/lib/puppet/concat/_etc_swift_container-server.conf/fragments/00_swift-container-6001"
end
it { should contain_file(fragment_file).with_content(/^allowed_sync_hosts = 127.0.0.1$/) }
describe 'with allowed_sync_hosts' do
let :params do
{ :allowed_sync_hosts => ['127.0.0.1', '10.1.0.1', '10.1.0.2'], }
end
it {
should contain_file(fragment_file).with_content(/^allowed_sync_hosts = 127.0.0.1,10.1.0.1,10.1.0.2$/)
}
end
end
end
end

View File

@ -6,6 +6,7 @@ mount_check = <%= mount_check %>
user = <%= user %>
log_facility = <%= log_facility %>
workers = <%= workers %>
allowed_sync_hosts = <%= scope.lookupvar("swift::storage::container::allowed_sync_hosts").to_a.join(',') %>
[pipeline:main]
pipeline = <%= pipeline.to_a.join(' ') %>