Create ring builders under swift user

Since we're running ring rebalance under 'swift' user, we also
need to create ring builders under the same user.

Change-Id: I04972e883b8f5f6355737545525f6dc32582563d
Related-bug: #1518305
This commit is contained in:
Kyrylo Galanov 2015-11-20 18:00:29 +02:00
parent 1dfe3d29a9
commit bc2085a274
2 changed files with 12 additions and 3 deletions

View File

@ -11,13 +11,17 @@
# Optional. Defaults to 3
# [*min_part_hours*] Time before a partition can be moved.
# Optional. Defaults to 24.
# [*user*] User to run as
# Optional. Defaults to 'swift'
#
# == Examples
#
# swift::ringbuilder::create { 'account':
# part_power => 19,
# replicas => 5,
# min_part_hours => 1,
# user => 'swift',
# }
#
# == Authors
@ -31,7 +35,8 @@
define swift::ringbuilder::create(
$part_power = 18,
$replicas = 3,
$min_part_hours = 24
$min_part_hours = 24,
$user = 'swift'
) {
validate_re($name, '^object|container|account$')
@ -39,6 +44,7 @@ define swift::ringbuilder::create(
exec { "create_${name}":
command => "swift-ring-builder /etc/swift/${name}.builder create ${part_power} ${replicas} ${min_part_hours}",
path => ['/usr/bin'],
user => $user,
creates => "/etc/swift/${name}.builder",
}

View File

@ -4,7 +4,8 @@ describe 'swift::ringbuilder::create' do
let :default_params do
{:part_power => 18,
:replicas => 3,
:min_part_hours => 24}
:min_part_hours => 24,
:user => 'swift'}
end
describe 'with allowed titles' do
@ -17,7 +18,8 @@ describe 'swift::ringbuilder::create' do
[{},
{:part_power => 19,
:replicas => 6,
:min_part_hours => 2}].each do |param_set|
:min_part_hours => 2,
:user => 'root'}].each do |param_set|
describe "when #{param_set == {} ? "using default" : "specifying"} class parame
ters" do
@ -32,6 +34,7 @@ describe 'swift::ringbuilder::create' do
it { is_expected.to contain_exec("create_#{type}").with(
{:command => "swift-ring-builder /etc/swift/#{type}.builder create #{param_hash[:part_power]} #{param_hash[:replicas]} #{param_hash[:min_part_hours]}",
:path => ['/usr/bin'],
:user => param_hash[:user],
:creates => "/etc/swift/#{type}.builder" }
)}
end