From 2b103c40a7eee5f2395db8779c380a95f7f7ca47 Mon Sep 17 00:00:00 2001 From: Alfredo Moralejo Date: Thu, 15 Sep 2022 16:51:54 +0200 Subject: [PATCH] Fix compatibility with oslo.db 12.1.0 oslo.db 12.1.0 has changed the default value for the 'autocommit' parameter of 'LegacyEngineFacade' from 'True' to 'False'. This is a necessary step to ensure compatibility with SQLAlchemy 2.0. However, we are currently relying on the autocommit behavior and need changes to explicitly manage sessions. Until that happens, we need to override the default. This also moves the watcher queue declaration from the pipeline level (where it is no longer valid) to the project level. Co-Authored-By: Thierry Carrez Co-Authored-By: Stephen Finucane (cherry picked from commit 5d70c207cddbaedceba6e1e6e9ae89bbd851aacc) Change-Id: I7db39d958d087322bfa0aad70dfbd04de9228dd7 --- .zuul.yaml | 2 +- watcher/db/sqlalchemy/api.py | 6 +++++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/.zuul.yaml b/.zuul.yaml index 49216f465..6d7c2d244 100644 --- a/.zuul.yaml +++ b/.zuul.yaml @@ -1,4 +1,5 @@ - project: + queue: watcher templates: - check-requirements - openstack-cover-jobs @@ -14,7 +15,6 @@ - watcherclient-tempest-functional - watcher-tempest-functional-ipv6-only gate: - queue: watcher jobs: - watcher-tempest-functional - watcher-tempest-functional-ipv6-only diff --git a/watcher/db/sqlalchemy/api.py b/watcher/db/sqlalchemy/api.py index ab1fc84fb..a13cc566c 100644 --- a/watcher/db/sqlalchemy/api.py +++ b/watcher/db/sqlalchemy/api.py @@ -44,7 +44,11 @@ _FACADE = None def _create_facade_lazily(): global _FACADE if _FACADE is None: - _FACADE = db_session.EngineFacade.from_config(CONF) + # FIXME(amoralej): Remove autocommit=True (and ideally use of + # LegacyEngineFacade) asap since it's not compatible with SQLAlchemy + # 2.0. + _FACADE = db_session.EngineFacade.from_config(CONF, + autocommit=True) return _FACADE