Skip to content

Commit 0ce2c41

Browse files
mnaserscrungus
authored andcommitted
Switch to using enginefacade
Closes-Bug: #2067345 Change-Id: If9a2c96628cfcb819fee5e19f872ea015979b30f
1 parent 8d09169 commit 0ce2c41

File tree

6 files changed

+441
-381
lines changed

6 files changed

+441
-381
lines changed

magnum/common/context.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212

1313
from eventlet.green import threading
1414
from oslo_context import context
15+
from oslo_db.sqlalchemy import enginefacade
1516

1617
from magnum.common import policy
1718

@@ -20,6 +21,7 @@
2021
CONF = magnum.conf.CONF
2122

2223

24+
@enginefacade.transaction_context_provider
2325
class RequestContext(context.RequestContext):
2426
"""Extends security contexts from the OpenStack common library."""
2527

magnum/db/sqlalchemy/alembic/env.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@
1313
from logging import config as log_config
1414

1515
from alembic import context
16+
from oslo_db.sqlalchemy import enginefacade
1617

17-
from magnum.db.sqlalchemy import api as sqla_api
1818
from magnum.db.sqlalchemy import models
1919

2020
# this is the Alembic Config object, which provides
@@ -43,7 +43,7 @@ def run_migrations_online():
4343
and associate a connection with the context.
4444
4545
"""
46-
engine = sqla_api.get_engine()
46+
engine = enginefacade.writer.get_engine()
4747
with engine.connect() as connection:
4848
context.configure(connection=connection,
4949
target_metadata=target_metadata)

0 commit comments

Comments
 (0)