diff --git a/manifests/object/ringbuilder.pp b/manifests/object/ringbuilder.pp index 5a2ba96e..56bfe389 100644 --- a/manifests/object/ringbuilder.pp +++ b/manifests/object/ringbuilder.pp @@ -16,6 +16,7 @@ # Swift ring builder node # class cloud::object::ringbuilder( + $enabled = false, $rsyncd_ipaddress = '127.0.0.1', $replicas = 3, $swift_rsync_max_connections = 5, @@ -23,24 +24,27 @@ class cloud::object::ringbuilder( include cloud::object - Ring_object_device <<| |>> - Ring_container_device <<| |>> - Ring_account_device <<| |>> + if $enabled { + Ring_object_device <<| |>> + Ring_container_device <<| |>> + Ring_account_device <<| |>> - class {'swift::ringbuilder' : - part_power => 15, - replicas => $replicas, - min_part_hours => 24, + class {'swift::ringbuilder' : + part_power => 15, + replicas => $replicas, + min_part_hours => 24, + } + + class {'swift::ringserver' : + local_net_ip => $rsyncd_ipaddress, + max_connections => $swift_rsync_max_connections, + } + + # exports rsync gets that can be used to sync the ring files + @@swift::ringsync { ['account', 'object', 'container']: + ring_server => $rsyncd_ipaddress, + } } - class {'swift::ringserver' : - local_net_ip => $rsyncd_ipaddress, - max_connections => $swift_rsync_max_connections, - } - - # exports rsync gets that can be used to sync the ring files - @@swift::ringsync { ['account', 'object', 'container']: - ring_server => $rsyncd_ipaddress, - } } diff --git a/spec/classes/cloud_object_ringbuilder_spec.rb b/spec/classes/cloud_object_ringbuilder_spec.rb index 4a3b6e1b..06f4806c 100644 --- a/spec/classes/cloud_object_ringbuilder_spec.rb +++ b/spec/classes/cloud_object_ringbuilder_spec.rb @@ -6,9 +6,10 @@ describe 'cloud::object::ringbuilder' do let :params do { - :rsyncd_ipaddress => '127.0.0.1', + :rsyncd_ipaddress => '127.0.0.1', :replicas => 3, :swift_rsync_max_connections => 5, + :enabled => true } end @@ -27,6 +28,16 @@ describe 'cloud::object::ringbuilder' do }) end + context 'when ringbuilder is not enabled' do + before do + params.merge!( + :enabled => false + ) + end + it 'should not configure swift ring builder' do + should_not contain_class('swift::ringbuilder') + end + end end context 'on Debian platforms' do