Merge "Remove deprecated database_connection in init"
This commit is contained in:
@@ -19,19 +19,15 @@ class gnocchi::db (
|
|||||||
|
|
||||||
include gnocchi::deps
|
include gnocchi::deps
|
||||||
|
|
||||||
# NOTE(spredzy): In order to keep backward compatibility we rely on the pick function
|
validate_legacy(Oslo::Dbconn, 'validate_re', $database_connection,
|
||||||
# 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,
|
|
||||||
['^(sqlite|mysql(\+pymysql)?|postgresql):\/\/(\S+:\S+@\S+\/\S+)?'])
|
['^(sqlite|mysql(\+pymysql)?|postgresql):\/\/(\S+:\S+@\S+\/\S+)?'])
|
||||||
|
|
||||||
if $database_connection_real {
|
if $database_connection {
|
||||||
case $database_connection_real {
|
case $database_connection {
|
||||||
/^mysql(\+pymysql)?:\/\//: {
|
/^mysql(\+pymysql)?:\/\//: {
|
||||||
require mysql::bindings
|
require mysql::bindings
|
||||||
require mysql::bindings::python
|
require mysql::bindings::python
|
||||||
if $database_connection_real =~ /^mysql\+pymysql/ {
|
if $database_connection =~ /^mysql\+pymysql/ {
|
||||||
$backend_package = $::gnocchi::params::pymysql_package_name
|
$backend_package = $::gnocchi::params::pymysql_package_name
|
||||||
} else {
|
} else {
|
||||||
$backend_package = false
|
$backend_package = false
|
||||||
@@ -58,7 +54,7 @@ class gnocchi::db (
|
|||||||
}
|
}
|
||||||
|
|
||||||
gnocchi_config {
|
gnocchi_config {
|
||||||
'indexer/url': value => $database_connection_real, secret => true;
|
'indexer/url': value => $database_connection, secret => true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if $::gnocchi::params::indexer_package_name != undef {
|
if $::gnocchi::params::indexer_package_name != undef {
|
||||||
|
@@ -17,27 +17,13 @@
|
|||||||
# in the gnocchi config.
|
# in the gnocchi config.
|
||||||
# Defaults to false.
|
# Defaults to false.
|
||||||
#
|
#
|
||||||
# DEPRECATED PARAMETERS
|
|
||||||
#
|
|
||||||
# [*database_connection*]
|
|
||||||
# (optional) Connection url for the gnocchi database.
|
|
||||||
# Defaults to undef.
|
|
||||||
#
|
|
||||||
class gnocchi (
|
class gnocchi (
|
||||||
$package_ensure = 'present',
|
$package_ensure = 'present',
|
||||||
$coordination_url = $::os_service_default,
|
$coordination_url = $::os_service_default,
|
||||||
$purge_config = false,
|
$purge_config = false,
|
||||||
# DEPRECATED PARAMETERS
|
|
||||||
$database_connection = undef,
|
|
||||||
) inherits gnocchi::params {
|
) inherits gnocchi::params {
|
||||||
|
|
||||||
include gnocchi::deps
|
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':
|
package { 'gnocchi':
|
||||||
ensure => $package_ensure,
|
ensure => $package_ensure,
|
||||||
|
@@ -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.
|
@@ -24,7 +24,7 @@ describe 'gnocchi::db' do
|
|||||||
|
|
||||||
context 'with postgresql backend' do
|
context 'with postgresql backend' do
|
||||||
let :params do
|
let :params do
|
||||||
{ :database_connection => 'postgresql://gnocchi:gnocchi@localhost/gnocchi', }
|
{ :database_connection => 'postgresql://gnocchi:gnocchi@localhost/gnocchi', }
|
||||||
end
|
end
|
||||||
|
|
||||||
it { should contain_package('python-psycopg2').with_ensure('present') }
|
it { should contain_package('python-psycopg2').with_ensure('present') }
|
||||||
|
Reference in New Issue
Block a user