Remove race condition at ceilometer::db initialisation
On the first run, the ceilometer::db class was failing due to the fact that the MongoDB service was not actually listening yet when it came to it. It return with an ERRNO 111 - ECONNREFUSED. This patch adds a dependency to ceilometer::db, this dependency ensure that the MongoDB service is listening before giving the hand to ceilometer::db. close #13
This commit is contained in:
parent
5bad6ae02d
commit
1c2911efde
@ -27,10 +27,19 @@ class cloud::telemetry::server(
|
||||
|
||||
include 'cloud::telemetry'
|
||||
|
||||
# Install MongoDB database
|
||||
$db_conn = regsubst($ceilometer_database_connection, 'mongodb:\/\/(\.*)', '\2')
|
||||
exec {'check_mongodb' :
|
||||
command => "/usr/bin/mongo ${db_conn}",
|
||||
logoutput => false,
|
||||
tries => 60,
|
||||
try_sleep => 5,
|
||||
require => Service['mongodb'],
|
||||
}
|
||||
|
||||
# Install MongoDB database
|
||||
class { 'ceilometer::db':
|
||||
database_connection => $ceilometer_database_connection,
|
||||
require => Class['mongodb']
|
||||
require => Exec['check_mongodb'],
|
||||
}
|
||||
|
||||
# Install Ceilometer-collector
|
||||
|
@ -61,6 +61,12 @@ describe 'cloud::telemetry::server' do
|
||||
should contain_ceilometer_config('DEFAULT/use_syslog').with('value' => 'yes')
|
||||
end
|
||||
|
||||
it 'check mongodb is started' do
|
||||
should contain_exec('check_mongodb').with({
|
||||
:command => '/usr/bin/mongo 10.0.0.2/ceilometer',
|
||||
})
|
||||
end
|
||||
|
||||
it 'configure ceilometer db' do
|
||||
should contain_class('ceilometer::db').with(
|
||||
:database_connection => 'mongodb://10.0.0.2/ceilometer'
|
||||
|
Loading…
x
Reference in New Issue
Block a user