Skip to content

Commit

Permalink
Switch to using enginefacade
Browse files Browse the repository at this point in the history
Closes-Bug: #2067345
Change-Id: If9a2c96628cfcb819fee5e19f872ea015979b30f
  • Loading branch information
mnaser authored and scrungus committed Oct 17, 2024
1 parent 1dcd259 commit 2e2984b
Show file tree
Hide file tree
Showing 6 changed files with 673 additions and 486 deletions.
2 changes: 2 additions & 0 deletions magnum/common/context.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@

from eventlet.green import threading
from oslo_context import context
from oslo_db.sqlalchemy import enginefacade

from magnum.common import policy

Expand All @@ -20,6 +21,7 @@
CONF = magnum.conf.CONF


@enginefacade.transaction_context_provider
class RequestContext(context.RequestContext):
"""Extends security contexts from the OpenStack common library."""

Expand Down
4 changes: 2 additions & 2 deletions magnum/db/sqlalchemy/alembic/env.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@
from logging import config as log_config

from alembic import context
from oslo_db.sqlalchemy import enginefacade

from magnum.db.sqlalchemy import api as sqla_api
from magnum.db.sqlalchemy import models

# this is the Alembic Config object, which provides
Expand Down Expand Up @@ -43,7 +43,7 @@ def run_migrations_online():
and associate a connection with the context.
"""
engine = sqla_api.get_engine()
engine = enginefacade.writer.get_engine()
with engine.connect() as connection:
context.configure(connection=connection,
target_metadata=target_metadata)
Expand Down
Loading

0 comments on commit 2e2984b

Please sign in to comment.