database: fix PostgreSQL connection string

If all databases drivers are loaded, MySQL SQLAlchemy driver
overrides all the other one that might not have set one.
This patches fixes that.

Change-Id: If6d8d08e5b7b7c48ca012677b536d71058def6fd
Closes-Bug: #1493304
This commit is contained in:
Julien Danjou
2015-09-08 10:45:06 +00:00
parent f86d2e1a05
commit 0eec4f86c1
3 changed files with 13 additions and 15 deletions
+8 -6
View File
@@ -12,12 +12,6 @@ MY_XTRACE=$(set +o | grep xtrace)
set +o xtrace
MYSQL_DRIVER=${MYSQL_DRIVER:-PyMySQL}
# Force over to pymysql driver by default if we are using it.
if is_service_enabled mysql; then
if [[ "$MYSQL_DRIVER" == "PyMySQL" ]]; then
SQLALCHEMY_DATABASE_DRIVER=${SQLALCHEMY_DATABASE_DRIVER:-"pymysql"}
fi
fi
register_database mysql
@@ -30,6 +24,14 @@ fi
# Functions
# ---------
function get_database_type_mysql {
if [[ "$MYSQL_DRIVER" == "PyMySQL" ]]; then
echo mysql+pymysql
else
echo mysql
fi
}
# Get rid of everything enough to cleanly change database backends
function cleanup_database_mysql {
stop_service $MYSQL
+4
View File
@@ -21,6 +21,10 @@ register_database postgresql
# Functions
# ---------
function get_database_type_postgresql {
echo postgresql
}
# Get rid of everything enough to cleanly change database backends
function cleanup_database_postgresql {
stop_service postgresql