optional pymysql support
This allows you to specify MYSQL_DRIVER=PyMySQL and get it in the
environment.
Change-Id: Ic9d75266640b7aa6d7efb6e882d3027e81414059
diff --git a/files/venv-requirements.txt b/files/venv-requirements.txt
index 73d0579..b9a55b4 100644
--- a/files/venv-requirements.txt
+++ b/files/venv-requirements.txt
@@ -1,7 +1,6 @@
# Once we can prebuild wheels before a devstack run, uncomment the skipped libraries
cryptography
# lxml # still install from from packages
-MySQL-python
# netifaces # still install from packages
#numpy # slowest wheel by far, stop building until we are actually using the output
posix-ipc
diff --git a/lib/databases/mysql b/lib/databases/mysql
index 1b9a081..7cd2856 100644
--- a/lib/databases/mysql
+++ b/lib/databases/mysql
@@ -11,6 +11,13 @@
MY_XTRACE=$(set +o | grep xtrace)
set +o xtrace
+MYSQL_DRIVER=${MYSQL_DRIVER:-MySQL-python}
+# 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
@@ -155,8 +162,10 @@
function install_database_python_mysql {
# Install Python client module
- pip_install_gr MySQL-python
- ADDITIONAL_VENV_PACKAGES+=",MySQL-python"
+ pip_install_gr $MYSQL_DRIVER
+ if [[ "$MYSQL_DRIVER" == "MySQL-python" ]]; then
+ ADDITIONAL_VENV_PACKAGES+=",MySQL-python"
+ fi
}
function database_connection_url_mysql {