Remove deprecated database_connection in init

Change-Id: I92f04101059ae5711f91df8740141ad532bc053c
This commit is contained in:
Tobias Urdin 2020-08-31 00:05:47 +02:00
parent f7e1857771
commit fca0e2d424
4 changed files with 16 additions and 27 deletions

View File

@ -19,19 +19,15 @@ class gnocchi::db (
include gnocchi::deps
# NOTE(spredzy): In order to keep backward compatibility we rely on the pick function
# to use gnocchi::<myparam> if gnocchi::db::<myparam> isn't specified.
$database_connection_real = pick($::gnocchi::database_connection, $database_connection)
validate_legacy(Oslo::Dbconn, 'validate_re', $database_connection_real,
validate_legacy(Oslo::Dbconn, 'validate_re', $database_connection,
['^(sqlite|mysql(\+pymysql)?|postgresql):\/\/(\S+:\S+@\S+\/\S+)?'])
if $database_connection_real {
case $database_connection_real {
if $database_connection {
case $database_connection {
/^mysql(\+pymysql)?:\/\//: {
require mysql::bindings
require mysql::bindings::python
if $database_connection_real =~ /^mysql\+pymysql/ {
if $database_connection =~ /^mysql\+pymysql/ {
$backend_package = $::gnocchi::params::pymysql_package_name
} else {
$backend_package = false
@ -58,7 +54,7 @@ class gnocchi::db (
}
gnocchi_config {
'indexer/url': value => $database_connection_real, secret => true;
'indexer/url': value => $database_connection, secret => true;
}
# NOTE(tobasco): gnocchi-indexer-sqlalchemy not packaged in Ubuntu for Queens release.

View File

@ -17,27 +17,13 @@
# in the gnocchi config.
# Defaults to false.
#
# DEPRECATED PARAMETERS
#
# [*database_connection*]
# (optional) Connection url for the gnocchi database.
# Defaults to undef.
#
class gnocchi (
$package_ensure = 'present',
$coordination_url = $::os_service_default,
$purge_config = false,
# DEPRECATED PARAMETERS
$database_connection = undef,
$package_ensure = 'present',
$coordination_url = $::os_service_default,
$purge_config = false,
) inherits gnocchi::params {
include gnocchi::deps
include gnocchi::db
if $database_connection {
warning('The gnocchi::database_connection parameter is deprecated. \
Use gnocchi::db::database_connection instead.')
}
package { 'gnocchi':
ensure => $package_ensure,

View File

@ -0,0 +1,7 @@
---
upgrade:
- |
The deprecated gnocchi::database_connection parameter is removed.
Use the gnocchi:db::database_connection parameter instead.
- |
Deployments now need to explicitly use the gnocchi::db class.

View File

@ -24,7 +24,7 @@ describe 'gnocchi::db' do
context 'with postgresql backend' do
let :params do
{ :database_connection => 'postgresql://gnocchi:gnocchi@localhost/gnocchi', }
{ :database_connection => 'postgresql://gnocchi:gnocchi@localhost/gnocchi', }
end
it { should contain_package('python-psycopg2').with_ensure('present') }