diff options
| author | Jenkins <jenkins@review.openstack.org> | 2013-06-22 01:32:57 +0000 |
|---|---|---|
| committer | Gerrit Code Review <review@openstack.org> | 2013-06-22 01:32:57 +0000 |
| commit | 97225ffc034c2c8b82266ef875edaa4db9efa322 (patch) | |
| tree | 51f2650a7bebe4a9f204ea906bb245e1b55810e3 /keystone | |
| parent | 49f5385b8d5474c7846624a8f04566570d949650 (diff) | |
| parent | 316f059a0e18e705c0fe276f181445b05ba087ea (diff) | |
Merge "Base.get_engine honor allow_global_engine=False"
Diffstat (limited to 'keystone')
| -rw-r--r-- | keystone/common/sql/core.py | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/keystone/common/sql/core.py b/keystone/common/sql/core.py index 694d30bd..e1bd138e 100644 --- a/keystone/common/sql/core.py +++ b/keystone/common/sql/core.py @@ -99,10 +99,6 @@ def set_global_engine(engine): GLOBAL_ENGINE = engine -def get_global_engine(): - return GLOBAL_ENGINE - - # Special Fields class JsonBlob(sql_types.TypeDecorator): @@ -244,14 +240,19 @@ class Base(object): return sql.create_engine(CONF.sql.connection, **engine_config) - engine = get_global_engine() or new_engine() + if not allow_global_engine: + return new_engine() + + if GLOBAL_ENGINE: + return GLOBAL_ENGINE + + engine = new_engine() # auto-build the db to support wsgi server w/ in-memory backend - if allow_global_engine and CONF.sql.connection == 'sqlite://': + if CONF.sql.connection == 'sqlite://': ModelBase.metadata.create_all(bind=engine) - if allow_global_engine: - set_global_engine(engine) + set_global_engine(engine) return engine |
