Change order of init _facade and osprofiler

Initialize osprofiler in sqlalchemy/api.py failed with message:

'NoneType' object has no attribute 'get_engine'

Re-oder to init osprofiler after _facade will fix this issue.

Change-Id: I420f12f382c4712a692dfa440958b2e497dc22a1
Closes-Bug: #1657326
This commit is contained in:
Tovin Seven 2017-01-18 09:38:30 +07:00
parent 9014a2b3c1
commit 936b3c3714
1 changed files with 1 additions and 1 deletions

View File

@ -71,12 +71,12 @@ def get_facade():
# to talk to each other, however one needs to be added to oslo.db
# to allow access to the Engine once constructed.
db_context.configure(**CONF.database)
_facade = db_context.get_legacy_facade()
if CONF.profiler.enabled:
if CONF.profiler.trace_sqlalchemy:
osprofiler.sqlalchemy.add_tracing(sqlalchemy,
_facade.get_engine(),
"db")
_facade = db_context.get_legacy_facade()
return _facade