From f6e34c9017f77c70d6cf0db73a6d5032f582ba2d Mon Sep 17 00:00:00 2001 From: Jeremy Stanley Date: Wed, 20 May 2015 01:03:58 +0000 Subject: [PATCH] Switch from MySQL-python to PyMySQL As discussed in the Liberty Design Summit "Moving apps to Python 3" cross-project workshop, the way forward in the near future is to switch to the pure-python PyMySQL library as a default. https://etherpad.openstack.org/p/liberty-cross-project-python3 Also set the OS_TEST_DBAPI_ADMIN_CONNECTION override variable so that oslo.db opportunistic detection will know to use PyMySQL until I12b32dc097a121bd43991bc38dd4d289b65e86c1 makes it the default behavior. Change-Id: I17e052215ce6e1604cdda848ccc20862452ccbc7 Co-Authored-By: Victor Sergeyev --- doc/source/scale_deployment.rst | 4 ++-- install.sh | 2 +- test-requirements.txt | 2 +- tox.ini | 1 + 4 files changed, 5 insertions(+), 4 deletions(-) diff --git a/doc/source/scale_deployment.rst b/doc/source/scale_deployment.rst index 07cc8787c7..2c702a8e8f 100644 --- a/doc/source/scale_deployment.rst +++ b/doc/source/scale_deployment.rst @@ -284,7 +284,7 @@ The original file from A looks like: [DEFAULT] ... - sql_connection = mysql://root:admin@127.0.0.1/heat?charset=utf8 + sql_connection = mysql+pymysql://root:admin@127.0.0.1/heat?charset=utf8 rabbit_host = localhost ... [heat_api] @@ -300,7 +300,7 @@ After the changes for B, it looks like: [DEFAULT] ... - sql_connection = mysql://root:admin@10.0.0.1/heat?charset=utf8 + sql_connection = mysql+pymysql://root:admin@10.0.0.1/heat?charset=utf8 rabbit_host = 10.0.0.1 ... [heat_api] diff --git a/install.sh b/install.sh index 657ecdf767..822580937a 100755 --- a/install.sh +++ b/install.sh @@ -73,7 +73,7 @@ basic_configuration() { if echo $conf_path | grep ".conf$" >/dev/null 2>&1 then iniset $target DEFAULT auth_encryption_key `hexdump -n 16 -v -e '/1 "%02x"' /dev/random` - iniset $target database connection "mysql://heat:heat@localhost/heat" + iniset $target database connection "mysql+pymysql://heat:heat@localhost/heat" BRIDGE_IP=127.0.0.1 iniset $target DEFAULT heat_metadata_server_url "http://${BRIDGE_IP}:8000/" diff --git a/test-requirements.txt b/test-requirements.txt index 489d5e1a2e..fd2d78ebdd 100644 --- a/test-requirements.txt +++ b/test-requirements.txt @@ -8,7 +8,7 @@ coverage>=3.6 discover mock>=1.0 mox>=0.5.3 -MySQL-python +PyMySQL>=0.6.2 # MIT License oslosphinx>=2.5.0 # Apache-2.0 oslotest>=1.5.1 # Apache-2.0 paramiko>=1.13.0 diff --git a/tox.ini b/tox.ini index c817c32b85..3b2396644e 100644 --- a/tox.ini +++ b/tox.ini @@ -7,6 +7,7 @@ skipsdist = True # Note the hash seed is set to 0 until heat can be tested with a # random hash seed successfully. setenv = VIRTUAL_ENV={envdir} + OS_TEST_DBAPI_ADMIN_CONNECTION=mysql+pymysql://openstack_citest:openstack_citest@localhost/;postgresql://openstack_citest:openstack_citest@localhost/postgres;sqlite:// PYTHONHASHSEED=0 usedevelop = True install_command = pip install {opts} {packages}