allow to specify drivername for postgresql db
Change-Id: Idbac640aba8f4c87ae43df3a7019bf465895ca43
This commit is contained in:
@@ -138,7 +138,7 @@ define oslo::db(
|
|||||||
if !is_service_default($connection) {
|
if !is_service_default($connection) {
|
||||||
|
|
||||||
validate_re($connection,
|
validate_re($connection,
|
||||||
'^(sqlite|mysql(\+pymysql)?|postgresql|mongodb):\/\/(\S+:\S+@\S+\/\S+)?')
|
'^(sqlite|mysql(\+pymysql)?|postgresql(\+psycopg2)?|mongodb):\/\/(\S+:\S+@\S+\/\S+)?')
|
||||||
|
|
||||||
if $manage_backend_package {
|
if $manage_backend_package {
|
||||||
case $connection {
|
case $connection {
|
||||||
@@ -151,7 +151,7 @@ define oslo::db(
|
|||||||
$backend_package = false
|
$backend_package = false
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/^postgresql:\/\//: {
|
/^postgresql(\+psycopg2)?:\/\//: {
|
||||||
$backend_package = false
|
$backend_package = false
|
||||||
require '::postgresql::lib::python'
|
require '::postgresql::lib::python'
|
||||||
}
|
}
|
||||||
|
5
releasenotes/notes/postgresql-590a36045748761a.yaml
Normal file
5
releasenotes/notes/postgresql-590a36045748761a.yaml
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
---
|
||||||
|
features:
|
||||||
|
- allow to specify a full dbname+drivername://
|
||||||
|
protocol URL for postgresql databases.
|
||||||
|
|
@@ -143,6 +143,14 @@ describe 'oslo::db' do
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
context 'with postgresql backend + drivername' do
|
||||||
|
let :params do
|
||||||
|
{ :connection => 'postgresql+psycopg2://db:db@localhost/db' }
|
||||||
|
end
|
||||||
|
|
||||||
|
it { is_expected.to contain_keystone_config('database/connection').with_value('postgresql+psycopg2://db:db@localhost/db').with_secret(true) }
|
||||||
|
end
|
||||||
|
|
||||||
context 'with incorrect database_connection string' do
|
context 'with incorrect database_connection string' do
|
||||||
let :params do
|
let :params do
|
||||||
{ :connection => 'foo://db:db@localhost/db', }
|
{ :connection => 'foo://db:db@localhost/db', }
|
||||||
|
Reference in New Issue
Block a user