Avoid duplication error when ringserver and storage are on the same node

This commit aims to avoid duplication error when the ringserver and the storage node
are on the same machine. For example when using loopback devices.

Change-Id: Ic09af5d3a706d1a59c3fee7689b373d0a4de4e80
This commit is contained in:
Yanis Guenane 2014-05-29 11:49:20 -04:00
parent 29ade00640
commit f7d1385d69
2 changed files with 93 additions and 4 deletions

View File

@ -23,10 +23,12 @@ class swift::ringserver(
Class['ringbuilder'] -> Class['swift::ringserver'] Class['ringbuilder'] -> Class['swift::ringserver']
class { 'rsync::server': if !defined(Class['rsync::server']) {
use_xinetd => true, class { 'rsync::server':
address => $local_net_ip, use_xinetd => true,
use_chroot => 'no', address => $local_net_ip,
use_chroot => 'no',
}
} }
rsync::server::module { 'swift_server': rsync::server::module { 'swift_server':

View File

@ -0,0 +1,87 @@
require 'spec_helper'
describe 'swift::ringserver' do
context 'when storage.pp was already included' do
let :pre_condition do
"class { 'swift::storage': storage_local_net_ip => '127.0.0.1' }
class {'swift' : swift_hash_suffix => 'eee' }
include swift::ringbuilder"
end
let :facts do
{
:operatingsystem => 'Ubuntu',
:osfamily => 'Debian'
}
end
let :params do
{
:local_net_ip => '127.0.0.1',
:max_connections => 5
}
end
it 'does not create the rsync::server class' do
should compile
end
it 'contain the swift_server rsync block' do
should contain_rsync__server__module('swift_server').with({
'path' => '/etc/swift',
'lock_file' => '/var/lock/swift_server.lock',
'uid' => 'swift',
'gid' => 'swift',
'max_connections' => '5',
'read_only' => 'true'
})
end
end
context 'when storage.pp was not already included' do
let :pre_condition do
"class {'swift' : swift_hash_suffix => 'eee' }
include swift::ringbuilder"
end
let :facts do
{
:operatingsystem => 'Ubuntu',
:osfamily => 'Debian'
}
end
let :params do
{
:local_net_ip => '127.0.0.1',
:max_connections => 5
}
end
it 'does create the rsync::server class' do
should contain_class('rsync::server').with({
'use_xinetd' => 'true',
'address' => '127.0.0.1',
'use_chroot' => 'no'
})
end
it 'contain the swift_server rsync block' do
should contain_rsync__server__module('swift_server').with({
'path' => '/etc/swift',
'lock_file' => '/var/lock/swift_server.lock',
'uid' => 'swift',
'gid' => 'swift',
'max_connections' => '5',
'read_only' => 'true'
})
end
end
end