db: Use postgresql lib class for psycopg package

This patch introduce the same design than mysql for postgresql
by requiring dedicated lib::python class instead of declaring
a new resource package within murano module.

Change-Id: I827c58174f235c7e3fafd9701a5b2fad261f2c4f
This commit is contained in:
Sebastien Badia 2015-10-20 16:39:59 +02:00
parent 4dd4fd5a13
commit 148b3da5ff
3 changed files with 20 additions and 6 deletions

View File

@ -62,7 +62,7 @@ class murano::db (
require mysql::bindings::python
}
/^postgresql:\/\//: {
$backend_package = $::murano::params::psycopg_package_name
$backend_package = false
require postgresql::lib::python
}
default: {

View File

@ -14,7 +14,6 @@ class murano::params {
$engine_package_name = 'openstack-murano-engine'
$pythonclient_package_name = 'openstack-python-muranoclient'
$dashboard_package_name = 'openstack-murano-dashboard'
$psycopg_package_name = 'python-psycopg2'
# service names
$api_service_name = 'murano-api'
$engine_service_name = 'murano-engine'
@ -28,7 +27,6 @@ class murano::params {
$engine_package_name = 'murano-engine'
$pythonclient_package_name = 'python-muranoclient'
$dashboard_package_name = 'python-murano-dashboard'
$psycopg_package_name = 'python-psycopg2'
# service names
$api_service_name = 'murano-api'
$engine_service_name = 'murano-engine'

View File

@ -34,6 +34,17 @@ describe 'murano::db' do
it { is_expected.to contain_murano_config('database/max_overflow').with_value('21') }
end
context 'with postgresql backend' do
let :params do
{ :database_connection => 'postgresql://murano:murano@localhost/murano', }
end
it 'install the proper backend package' do
is_expected.to contain_package('python-psycopg2').with(:ensure => 'present')
end
end
context 'with incorrect database_connection string' do
let :params do
{ :database_connection => 'sqlite://murano:murano@localhost/murano', }
@ -45,7 +56,10 @@ describe 'murano::db' do
context 'on Debian platforms' do
let :facts do
{ :osfamily => 'Debian' }
{ :osfamily => 'Debian',
:operatingsystem => 'Debian',
:operatingsystemrelease => 'jessie',
}
end
it_configures 'murano::db'
@ -53,10 +67,12 @@ describe 'murano::db' do
context 'on Redhat platforms' do
let :facts do
{ :osfamily => 'RedHat' }
{ :osfamily => 'RedHat',
:operatingsystemrelease => '7.1',
}
end
it_configures 'murano::db'
end
end
end