Merge "Share one engine for more than just sqlite in-memory" into milestone-proposed

This commit is contained in:
Jenkins 2013-04-02 07:52:37 +00:00 committed by Gerrit Code Review
commit d5dcb3babf
2 changed files with 5 additions and 2 deletions

View File

@ -30,7 +30,6 @@ from keystone.common import logging
from keystone import config
from keystone import exception
from keystone.openstack.common import jsonutils
from keystone import exception
CONF = config.CONF
@ -98,7 +97,6 @@ def set_global_engine(engine):
def get_global_engine():
global GLOBAL_ENGINE
return GLOBAL_ENGINE
@ -250,6 +248,8 @@ class Base(object):
# auto-build the db to support wsgi server w/ in-memory backend
if allow_global_engine and CONF.sql.connection == 'sqlite://':
ModelBase.metadata.create_all(bind=engine)
if allow_global_engine:
set_global_engine(engine)
return engine

View File

@ -17,6 +17,7 @@
import os
import shutil
from keystone.common.sql import core
from keystone.common.sql import migration
from keystone import config
@ -38,5 +39,7 @@ def setup_test_database():
def teardown_test_database():
core.set_global_engine(None)
if os.path.exists('test.db.pristine'):
os.unlink('test.db.pristine')