deprecate mongodb_replica_set parameter

mongodb_replica_set parameter has been dropped in Mitaka [1] and has no
effect anymore.
This patch deprecated our interface by sending a warning if the param is
set. If set, it has no effect though, since the param does not exist
anymore upstream.

[1] a6d608a332

Closes-Bug: #1528612
Change-Id: I49123b0f1353e24b217ea6f16f556ab25a6c86b0
This commit is contained in:
Emilien Macchi 2015-12-22 16:41:03 +01:00
parent 6e453d9873
commit 51fdead1dc
2 changed files with 8 additions and 15 deletions

View File

@ -36,7 +36,7 @@
# (Optional) Defaults to $::os_service_default
#
# [*mongodb_replica_set*]
# The name of the replica set which is used to connect to MongoDB
# DEPRECATED. The name of the replica set which is used to connect to MongoDB
# database. If it is set, MongoReplicaSetClient will be used instead
# of MongoClient.
# (Optional) Defaults to undef (string value).
@ -53,6 +53,7 @@ class ceilometer::db (
$database_retry_interval = $::os_service_default,
$database_max_overflow = $::os_service_default,
$sync_db = true,
# DEPRECATED PARAMETERS
$mongodb_replica_set = undef,
) {
@ -60,6 +61,10 @@ class ceilometer::db (
Package<| title == 'ceilometer-common' |> -> Class['ceilometer::db']
if $mongodb_replica_set {
warning('mongodb_replica_set parameter is deprecated in Mitaka and has no effect. Add ?replicaSet=myreplicatset in database_connection instead.')
}
validate_re($database_connection,
'^(sqlite|mysql(\+pymysql)?|postgresql|mongodb):\/\/(\S+:\S+@\S+\/\S+)?')
@ -79,11 +84,6 @@ class ceilometer::db (
}
/^mongodb:\/\//: {
$backend_package = $::ceilometer::params::pymongo_package_name
if $mongodb_replica_set {
ceilometer_config { 'database/mongodb_replica_set': value => $mongodb_replica_set; }
} else {
ceilometer_config { 'database/mongodb_replica_set': ensure => absent; }
}
}
/^sqlite:\/\//: {
$backend_package = $::ceilometer::params::sqlite_package_name

View File

@ -13,7 +13,6 @@ describe 'ceilometer::db' do
it { is_expected.to contain_ceilometer_config('database/min_pool_size').with_value('<SERVICE DEFAULT>') }
it { is_expected.to contain_ceilometer_config('database/max_retries').with_value('<SERVICE DEFAULT>') }
it { is_expected.to contain_ceilometer_config('database/retry_interval').with_value('<SERVICE DEFAULT>') }
it { is_expected.not_to contain_ceilometer_config('database/mongodb_replica_set') }
end
@ -34,7 +33,6 @@ describe 'ceilometer::db' do
it { is_expected.to contain_ceilometer_config('database/min_pool_size').with_value('2') }
it { is_expected.to contain_ceilometer_config('database/max_retries').with_value('11') }
it { is_expected.to contain_ceilometer_config('database/retry_interval').with_value('11') }
it { is_expected.to contain_ceilometer_config('database/mongodb_replica_set').with_ensure( 'absent' ) }
end
@ -48,10 +46,9 @@ describe 'ceilometer::db' do
it { is_expected.to contain_ceilometer_config('database/connection').with_value('mysql+pymysql://ceilometer:ceilometer@localhost/ceilometer').with_secret(true) }
end
context 'with mongodb backend and replica set' do
context 'with mongodb backend' do
let :params do
{ :database_connection => 'mongodb://localhost:1234/ceilometer',
:mongodb_replica_set => 'foobar' }
{ :database_connection => 'mongodb://localhost:1234/ceilometer' }
end
it 'install the proper backend package' do
@ -61,12 +58,8 @@ describe 'ceilometer::db' do
:tag => 'openstack'
)
end
it { is_expected.to contain_ceilometer_config('database/mongodb_replica_set').with_value( 'foobar' ) }
end
context 'with incorrect database_connection string' do
let :params do
{ :database_connection => 'redis://ceilometer:ceilometer@localhost/ceilometer', }