swift/ringbuilder: allow to disable the ring building

When using Hiera, it's usefull to have the "enabled" parameter to either
enable or disable the ring building, since it should be run on one
single node.

Signed-off-by: Emilien Macchi <emilien.macchi@enovance.com>
This commit is contained in:
Emilien Macchi 2014-06-11 13:54:30 +02:00
parent a1d6853552
commit ff448f8733
2 changed files with 32 additions and 17 deletions

View File

@ -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,
}
}

View File

@ -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