Validate that swift zones are integers.
As per the docs, zones are numbers starting at 1. http://docs.openstack.org/developer/swift/deployment_guide.html#preparing-the-ring Change-Id: I9bcc1616ad266b09ae4be65bf35b31ea0a455af7
This commit is contained in:
@@ -15,6 +15,8 @@ define swift::storage::node(
|
|||||||
$manage_ring = true
|
$manage_ring = true
|
||||||
) {
|
) {
|
||||||
|
|
||||||
|
validate_re($zone, '^\d+$', 'The zone parameter must be an integer')
|
||||||
|
|
||||||
Swift::Storage::Server {
|
Swift::Storage::Server {
|
||||||
storage_local_net_ip => $storage_local_net_ip,
|
storage_local_net_ip => $storage_local_net_ip,
|
||||||
devices => $mnt_base_dir,
|
devices => $mnt_base_dir,
|
||||||
|
@@ -31,4 +31,18 @@ describe 'swift::storage::node' do
|
|||||||
should contain_ring_container_device("127.0.0.1:6011/1")
|
should contain_ring_container_device("127.0.0.1:6011/1")
|
||||||
should contain_ring_account_device("127.0.0.1:6012/1")
|
should contain_ring_account_device("127.0.0.1:6012/1")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
context 'when zone is not a number' do
|
||||||
|
let(:title) { '1' }
|
||||||
|
let :params do
|
||||||
|
{ :zone => 'invalid',
|
||||||
|
:mnt_base_dir => '/srv/node' }
|
||||||
|
end
|
||||||
|
|
||||||
|
it 'should raise an error' do
|
||||||
|
expect {
|
||||||
|
subject
|
||||||
|
}.to raise_error(Puppet::Error, /The zone parameter must be an integer/)
|
||||||
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
Reference in New Issue
Block a user