Merge "Fix type validation warning for storage policy rings"
This commit is contained in:
@@ -41,8 +41,10 @@ define swift::ringbuilder::create(
|
||||
|
||||
include swift::deps
|
||||
|
||||
validate_legacy(Enum['object', 'container', 'account'], 'validate_re', $name,
|
||||
['^object|container|account$'])
|
||||
validate_legacy(
|
||||
Pattern[/^(object(-(\d)+)?|container|account)$/], 'validate_re', $name,
|
||||
['^(object(-(\d)+)?|container|account)$']
|
||||
)
|
||||
|
||||
exec { "create_${name}":
|
||||
command => "swift-ring-builder /etc/swift/${name}.builder create ${part_power} ${replicas} ${min_part_hours}",
|
||||
|
@@ -14,8 +14,10 @@ define swift::ringbuilder::rebalance(
|
||||
|
||||
include swift::deps
|
||||
|
||||
validate_legacy(Enum['object', 'container', 'account'], 'validate_re', $name,
|
||||
['^object|container|account$'])
|
||||
validate_legacy(
|
||||
Pattern[/^(object(-(\d)+)?|container|account)$/], 'validate_re', $name,
|
||||
['^(object(-(\d)+)?|container|account)$']
|
||||
)
|
||||
|
||||
if $seed {
|
||||
validate_legacy(Integer, 'validate_re', $seed, ['^\d+$'])
|
||||
|
@@ -12,7 +12,7 @@ describe 'swift::ringbuilder::create' do
|
||||
|
||||
shared_examples 'swift::ringbuilder::create' do
|
||||
describe 'with allowed titles' do
|
||||
['object', 'container', 'account'].each do |type|
|
||||
['object', 'container', 'account', 'object-1', 'object-123'].each do |type|
|
||||
describe "when title is #{type}" do
|
||||
let :title do
|
||||
type
|
||||
@@ -46,13 +46,17 @@ describe 'swift::ringbuilder::create' do
|
||||
end
|
||||
|
||||
describe 'with an invalid title' do
|
||||
['invalid', 'container-1', 'account-1', 'object-a', 'object-12a'].each do |type|
|
||||
describe "when title is #{type}" do
|
||||
let :title do
|
||||
'invalid'
|
||||
type
|
||||
end
|
||||
|
||||
it { should raise_error(Puppet::Error) }
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
on_supported_os({
|
||||
:supported_os => OSDefaults.get_supported_os
|
||||
|
@@ -3,7 +3,7 @@ require 'spec_helper'
|
||||
describe 'swift::ringbuilder::rebalance' do
|
||||
shared_examples 'swift::ringbuilder::rebalance' do
|
||||
describe 'with allowed titles' do
|
||||
['object', 'container', 'account'].each do |type|
|
||||
['object', 'container', 'account', 'object-1', 'object-123'].each do |type|
|
||||
describe "when title is #{type}" do
|
||||
let :title do
|
||||
type
|
||||
@@ -49,8 +49,10 @@ describe 'swift::ringbuilder::rebalance' do
|
||||
end
|
||||
|
||||
describe 'with an invalid title' do
|
||||
['invalid', 'container-1', 'account-1', 'object-a', 'object-12a'].each do |type|
|
||||
describe "when title is #{type}" do
|
||||
let :title do
|
||||
'invalid'
|
||||
type
|
||||
end
|
||||
|
||||
it 'should raise an error' do
|
||||
@@ -58,6 +60,8 @@ describe 'swift::ringbuilder::rebalance' do
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
on_supported_os({
|
||||
:supported_os => OSDefaults.get_supported_os
|
||||
|
Reference in New Issue
Block a user