From: Emilien Macchi Date: Tue, 22 Dec 2015 15:41:03 +0000 (+0100) Subject: deprecate mongodb_replica_set parameter X-Git-Tag: 8.0.0-rc1^2^2 X-Git-Url: https://review.fuel-infra.org/gitweb?a=commitdiff_plain;h=51fdead1dcd257314af1ae4941557221f7150aa5;p=puppet-modules%2Fpuppet-ceilometer.git 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] https://github.com/openstack/ceilometer/commit/a6d608a33235dfa0d4ef91e3a3d69359ceb0263f Closes-Bug: #1528612 Change-Id: I49123b0f1353e24b217ea6f16f556ab25a6c86b0 --- diff --git a/manifests/db.pp b/manifests/db.pp index 9a13979..00fe827 100644 --- a/manifests/db.pp +++ b/manifests/db.pp @@ -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 diff --git a/spec/classes/ceilometer_db_spec.rb b/spec/classes/ceilometer_db_spec.rb index 58dee2e..c56d254 100644 --- a/spec/classes/ceilometer_db_spec.rb +++ b/spec/classes/ceilometer_db_spec.rb @@ -13,7 +13,6 @@ describe 'ceilometer::db' do it { is_expected.to contain_ceilometer_config('database/min_pool_size').with_value('') } it { is_expected.to contain_ceilometer_config('database/max_retries').with_value('') } it { is_expected.to contain_ceilometer_config('database/retry_interval').with_value('') } - 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', }