diff --git a/deployment/puppet/swift/manifests/storage/filter/healthcheck.pp b/deployment/puppet/swift/manifests/storage/filter/healthcheck.pp new file mode 100644 index 0000000000..16427faf11 --- /dev/null +++ b/deployment/puppet/swift/manifests/storage/filter/healthcheck.pp @@ -0,0 +1,26 @@ +# +# Configure swift healthcheck. +# +# == Dependencies +# +# == Examples +# +# == Authors +# +# Dan Bode dan@puppetlabs.com +# François Charlier fcharlier@ploup.net +# +# == Copyright +# +# Copyright 2011 Puppetlabs Inc, unless otherwise noted. +# +define swift::storage::filter::healthcheck( +) { + + concat::fragment { "swift_healthcheck_${name}": + target => "/etc/swift/${name}-server.conf", + content => template('swift/proxy/healthcheck.conf.erb'), + order => '25', + } + +} diff --git a/deployment/puppet/swift/manifests/storage/filter/recon.pp b/deployment/puppet/swift/manifests/storage/filter/recon.pp new file mode 100644 index 0000000000..e99409244c --- /dev/null +++ b/deployment/puppet/swift/manifests/storage/filter/recon.pp @@ -0,0 +1,31 @@ +# +# Configure swift recon. +# +# == Parameters +# [cache_path] The path for recon cache +# Optional. Defaults to '/var/cache/swift/' +# +# == Dependencies +# +# == Examples +# +# == Authors +# +# Dan Bode dan@puppetlabs.com +# François Charlier fcharlier@ploup.net +# +# == Copyright +# +# Copyright 2011 Puppetlabs Inc, unless otherwise noted. +# +define swift::storage::filter::recon( + $cache_path = '/var/cache/swift' +) { + + concat::fragment { "swift_recon_${name}": + target => "/etc/swift/${name}-server.conf", + content => template('swift/recon.conf.erb'), + order => '35', + } + +} diff --git a/deployment/puppet/swift/spec/defines/swift_storage_filter_healthcheck_spec.rb b/deployment/puppet/swift/spec/defines/swift_storage_filter_healthcheck_spec.rb new file mode 100644 index 0000000000..0acd912c65 --- /dev/null +++ b/deployment/puppet/swift/spec/defines/swift_storage_filter_healthcheck_spec.rb @@ -0,0 +1,32 @@ +require 'spec_helper' + +describe 'swift::storage::filter::healthcheck' do + let :title do + 'dummy' + end + + let :facts do + { + :concat_basedir => '/var/lib/puppet/concat' + } + end + + let :pre_condition do + 'class { "concat::setup": } + concat { "/etc/swift/dummy-server.conf": }' + end + + let :fragment_file do + "/var/lib/puppet/concat/_etc_swift_dummy-server.conf/fragments/25_swift_healthcheck_dummy" + end + +it 'should build the fragment with correct content' do + verify_contents(subject, fragment_file, + [ + '[filter:healthcheck]', + 'use = egg:swift#healthcheck' + ] + ) +end + +end diff --git a/deployment/puppet/swift/spec/defines/swift_storage_filter_recon_spec.rb b/deployment/puppet/swift/spec/defines/swift_storage_filter_recon_spec.rb new file mode 100644 index 0000000000..a56f62f0dc --- /dev/null +++ b/deployment/puppet/swift/spec/defines/swift_storage_filter_recon_spec.rb @@ -0,0 +1,52 @@ +require 'spec_helper' + +describe 'swift::storage::filter::recon' do + let :title do + 'dummy' + end + + let :facts do + { + :concat_basedir => '/var/lib/puppet/concat' + } + end + + let :pre_condition do + 'class { "concat::setup": } + concat { "/etc/swift/dummy-server.conf": }' + end + + let :fragment_file do + "/var/lib/puppet/concat/_etc_swift_dummy-server.conf/fragments/35_swift_recon_dummy" + end + + describe 'when passing default parameters' do + it 'should build the fragment with correct content' do + verify_contents(subject, fragment_file, + [ + '[filter:recon]', + 'use = egg:swift#recon', + 'recon_cache_path = /var/cache/swift' + ] + ) + end + end + + describe 'when overriding default parameters' do + let :params do + { + :cache_path => '/some/other/path' + } + end + it 'should build the fragment with correct content' do + verify_contents(subject, fragment_file, + [ + '[filter:recon]', + 'use = egg:swift#recon', + 'recon_cache_path = /some/other/path' + ] + ) + end + end + +end diff --git a/deployment/puppet/swift/templates/recon.conf.erb b/deployment/puppet/swift/templates/recon.conf.erb new file mode 100644 index 0000000000..bb64ffcd5d --- /dev/null +++ b/deployment/puppet/swift/templates/recon.conf.erb @@ -0,0 +1,3 @@ +[filter:recon] +use = egg:swift#recon +recon_cache_path = <%= cache_path %>