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: Icd91a065d3c4f62791ba0dca99a822e3a1a0ad44 Co-Authored-By: Victor Sergeyev <vsergeyev@mirantis.com>
This commit is contained in:
parent
7fb2914309
commit
25f2c5e079
@ -69,7 +69,7 @@ The configuration file defines the database backend to use with the
|
||||
*connection* database option::
|
||||
|
||||
[database]
|
||||
connection=mysql://root@localhost/ironic
|
||||
connection=mysql+pymysql://root@localhost/ironic
|
||||
|
||||
If no configuration file is specified with the :option:`--config-file` option,
|
||||
:command:`ironic-dbsync` assumes an SQLite database.
|
||||
|
@ -169,7 +169,7 @@ so that the Bare Metal Service is configured for your needs.
|
||||
# The SQLAlchemy connection string used to connect to the
|
||||
# database (string value)
|
||||
#connection=<None>
|
||||
connection = mysql://ironic:IRONIC_DBPASSWORD@DB_IP/ironic?charset=utf8
|
||||
connection = mysql+pymysql://ironic:IRONIC_DBPASSWORD@DB_IP/ironic?charset=utf8
|
||||
|
||||
#. Configure the Bare Metal Service to use the RabbitMQ message broker by
|
||||
setting one or more of these options. Replace RABBIT_HOST with the
|
||||
|
@ -1,22 +0,0 @@
|
||||
# The order of packages is significant, because pip processes them in the order
|
||||
# of appearance. Changing the order has an impact on the overall integration
|
||||
# process, which may cause wedges in the gate later.
|
||||
hacking<0.11,>=0.10.0
|
||||
coverage>=3.6
|
||||
discover
|
||||
fixtures>=0.3.14
|
||||
mock>=1.0
|
||||
Babel>=1.3
|
||||
oslotest>=1.5.1 # Apache-2.0
|
||||
psycopg2
|
||||
PyMySQL>=0.6.2 # MIT License
|
||||
python-ironicclient>=0.2.1
|
||||
python-subunit>=0.0.18
|
||||
testrepository>=0.0.18
|
||||
testtools>=1.4.0
|
||||
|
||||
# Doc requirements
|
||||
sphinx!=1.2.0,!=1.3b1,<1.3,>=1.1.2
|
||||
sphinxcontrib-pecanwsme>=0.8
|
||||
oslosphinx>=2.5.0 # Apache-2.0
|
||||
|
@ -7,7 +7,7 @@ discover
|
||||
fixtures>=0.3.14
|
||||
mock>=1.0
|
||||
Babel>=1.3
|
||||
MySQL-python
|
||||
PyMySQL>=0.6.2 # MIT License
|
||||
oslotest>=1.5.1 # Apache-2.0
|
||||
psycopg2
|
||||
python-ironicclient>=0.2.1
|
||||
|
18
tox.ini
18
tox.ini
@ -7,6 +7,12 @@ envlist = py27,py34,pep8
|
||||
usedevelop = True
|
||||
install_command = pip install -U {opts} {packages}
|
||||
setenv = VIRTUAL_ENV={envdir}
|
||||
# NOTE(viktors): we must change default connection string for MySQL
|
||||
# because we are use PyMySQL as a DB connector, but opportunistic
|
||||
# migration tests uses MySQLdb by default.
|
||||
# TODO(viktors): Remove this evn variable, when Ironic will use
|
||||
# oslo.db>=1.12.0
|
||||
OS_TEST_DBAPI_ADMIN_CONNECTION=mysql+pymysql://openstack_citest:openstack_citest@localhost/;postgresql://openstack_citest:openstack_citest@localhost/postgres;sqlite://
|
||||
PYTHONDONTWRITEBYTECODE = 1
|
||||
LANGUAGE=en_US
|
||||
deps = -r{toxinidir}/requirements.txt
|
||||
@ -24,18 +30,6 @@ deps = {[testenv]deps}
|
||||
pydot2
|
||||
commands = {toxinidir}/tools/states_to_dot.py -f {toxinidir}/doc/source/images/states.svg --format svg
|
||||
|
||||
[testenv:py34]
|
||||
# NOTE(viktors): we must change default connection string for MySQL because
|
||||
# we use a different DB connector (PyMySQL, not MySQLdb) in py3x
|
||||
# env. So we should put new DB URLs in the env variable. This
|
||||
# will allow to run tests, that require MySQL database,
|
||||
# for example DB migration tests.
|
||||
setenv =
|
||||
{[testenv]setenv}
|
||||
OS_TEST_DBAPI_ADMIN_CONNECTION=mysql+pymysql://openstack_citest:openstack_citest@localhost/;postgresql://openstack_citest:openstack_citest@localhost/postgres;sqlite://
|
||||
deps = -r{toxinidir}/requirements.txt
|
||||
-r{toxinidir}/test-requirements-py3.txt
|
||||
|
||||
[testenv:pep8]
|
||||
commands =
|
||||
flake8 {posargs}
|
||||
|
Loading…
x
Reference in New Issue
Block a user