From c3da24303025f978c852dfde8babefd875322320 Mon Sep 17 00:00:00 2001 From: Mark McLoughlin Date: Mon, 4 Feb 2013 15:23:58 +0000 Subject: Eliminate gratuitous DB difference vs Nova Looks like this was an abritrary cleanup done as part of the import. It conflicts with a more recent change in Nova. We can move to using try_import() once we've killed the Nova copy of this code. Change-Id: I5c67d3fbd846a262feb724e26b14447a76561ae6 --- openstack/common/db/sqlalchemy/session.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'openstack/common/db/sqlalchemy/session.py') diff --git a/openstack/common/db/sqlalchemy/session.py b/openstack/common/db/sqlalchemy/session.py index 5bd35c8..0effd5c 100644 --- a/openstack/common/db/sqlalchemy/session.py +++ b/openstack/common/db/sqlalchemy/session.py @@ -248,9 +248,8 @@ from eventlet import db_pool from eventlet import greenthread try: import MySQLdb - HAS_MYSQLDB = True except ImportError: - HAS_MYSQLDB = None + MySQLdb = None from sqlalchemy.exc import DisconnectionError, OperationalError, IntegrityError import sqlalchemy.interfaces import sqlalchemy.orm @@ -504,7 +503,7 @@ def create_engine(sql_connection): if CONF.sql_connection == "sqlite://": engine_args["poolclass"] = StaticPool engine_args["connect_args"] = {'check_same_thread': False} - elif all((CONF.sql_dbpool_enable, HAS_MYSQLDB, + elif all((CONF.sql_dbpool_enable, MySQLdb, "mysql" in connection_dict.drivername)): LOG.info(_("Using mysql/eventlet db_pool.")) # MySQLdb won't accept 'None' in the password field -- cgit