Purge redundant database configuration

* this logic is already applyed by oslo::db
* remove duplicated code
* purge unused params
* update tests

Change-Id: Icbfd98e57ff1af3f9c5f7c37012e2f5d8685eb1e
This commit is contained in:
dmburmistrov 2016-04-12 20:46:21 +03:00
parent 07dd209c02
commit b63840b482
3 changed files with 2 additions and 37 deletions

View File

@ -49,7 +49,6 @@ class heat::db (
) {
include ::heat::deps
include ::heat::params
# NOTE(spredzy): In order to keep backward compatibility we rely on the pick function
# to use heat::<myparam> if heat::db::<myparam> isn't specified.
@ -65,36 +64,6 @@ class heat::db (
validate_re($database_connection_real,
'^(sqlite|mysql(\+pymysql)?|postgresql):\/\/(\S+:\S+@\S+\/\S+)?')
case $database_connection_real {
/^mysql(\+pymysql)?:\/\//: {
require 'mysql::bindings'
require 'mysql::bindings::python'
if $database_connection_real =~ /^mysql\+pymysql/ {
$backend_package = $::heat::params::pymysql_package_name
} else {
$backend_package = false
}
}
/^postgresql:\/\//: {
$backend_package = false
require 'postgresql::lib::python'
}
/^sqlite:\/\//: {
$backend_package = $::heat::params::sqlite_package_name
}
default: {
fail('Unsupported backend configured')
}
}
if $backend_package and !defined(Package[$backend_package]) {
package {'heat-backend-package':
ensure => present,
name => $backend_package,
tag => 'openstack',
}
}
oslo::db { 'heat_config':
connection => $database_connection_real,
idle_timeout => $database_idle_timeout_real,

View File

@ -13,8 +13,6 @@ class heat::params {
$engine_package_name = 'openstack-heat-engine'
$client_package_name = 'python-heatclient'
$common_package_name = 'openstack-heat-common'
$sqlite_package_name = undef
$pymysql_package_name = undef
# service names
$api_service_name = 'openstack-heat-api'
$api_cloudwatch_service_name = 'openstack-heat-api-cloudwatch'
@ -29,8 +27,6 @@ class heat::params {
$engine_package_name = 'heat-engine'
$client_package_name = 'python-heatclient'
$common_package_name = 'heat-common'
$sqlite_package_name = 'python-pysqlite2'
$pymysql_package_name = 'python-pymysql'
# service names
$api_service_name = 'heat-api'
$api_cloudwatch_service_name = 'heat-api-cloudwatch'

View File

@ -90,7 +90,7 @@ describe 'heat::db' do
{ :database_connection => 'mysql+pymysql://heat:heat@localhost/heat' }
end
it { is_expected.to contain_package('heat-backend-package').with({ :ensure => 'present', :name => 'python-pymysql' }) }
it { is_expected.to contain_package('db_backend_package').with({ :ensure => 'present', :name => 'python-pymysql' }) }
end
end
@ -109,7 +109,7 @@ describe 'heat::db' do
{ :database_connection => 'mysql+pymysql://heat:heat@localhost/heat' }
end
it { is_expected.not_to contain_package('heat-backend-package') }
it { is_expected.not_to contain_package('db_backend_package') }
end
end