Replace usage of get_legacy_facade() with get_engine()

We've been seeing warnings emitted to the python 3 unit tests:

  OsloDBDeprecationWarning: EngineFacade is deprecated; please use
  oslo_db.sqlalchemy.enginefacade

which stem from our use of the get_legacy_facade() oslo.db method.

This replaces the get_legacy_facade() usage with the get_engine()
method from the transaction context manager.

The same has been done for Nova:
https://review.openstack.org/#/c/606213

Change-Id: Ibc211d3587952db35a6dd40a8e5aaeb5e0d8dae2
This commit is contained in:
Vu Cong Tuan 2018-11-06 14:11:46 +07:00
parent e3c1633ea8
commit 0884b727ef
1 changed files with 1 additions and 1 deletions

View File

@ -53,7 +53,7 @@ def initialize_sql_session(connection_str=unit.IN_MEM_DB_CONN_STRING,
connection=connection_str)
# Enable the Sqlite FKs for global engine by default.
facade = enginefacade.get_legacy_facade()
facade = enginefacade.writer
engine = facade.get_engine()
f_key = 'ON' if enforce_sqlite_fks else 'OFF'
if engine.name == 'sqlite':