Files
puppet-swift/manifests/ringbuilder/rebalance.pp
Tobias Urdin ba1ec6d40c Use validate_legacy
This changes all the puppet 3 validate_* functions
to use the validate_legacy function.

The validate_legacy function has been available since
about three years but require Puppet >= 4.4.0 and since
there is Puppet 4.10.12 as latest we should assume people
are running a fairly new Puppet 4 version.

This is the first step to then remove all validate function
calls and use proper types for parameter as described in spec [1].

[1] https://review.openstack.org/#/c/568929/

Change-Id: I5661c2d685b4bf2422936326db1c3d543a49f92a
2019-02-25 22:49:42 +01:00

32 lines
907 B
Puppet

# Swift::Ring::Rebalance
# Reblances the specified ring. Assumes that the ring already exists
# and is stored at /etc/swift/${name}.builder
#
# == Parameters
#
# [*name*] Type of ring to rebalance. The ring file is assumed to be at the path
# /etc/swift/${name}.builder
#
# [*seed*] Optional. Seed value used to seed pythons pseudo-random for ringbuilding.
define swift::ringbuilder::rebalance(
$seed = undef
) {
include ::swift::deps
validate_legacy(Enum['object', 'container', 'account'], 'validate_re', $name,
['^object|container|account$'])
if $seed {
validate_legacy(Integer, 'validate_re', $seed, ['^\d+$'])
}
exec { "rebalance_${name}":
command => strip("swift-ring-builder /etc/swift/${name}.builder rebalance ${seed}"),
path => ['/usr/bin'],
refreshonly => true,
before => Anchor['swift::config::end'],
returns => [0, 1],
}
}