From b47479272a5ea0fc4b0cc81fd51f1ef6f20ccc9a Mon Sep 17 00:00:00 2001 From: Michal Nasiadka Date: Fri, 29 Nov 2024 15:14:15 +0100 Subject: [PATCH] Fix sqlalchemy with osprofiler Breakage seen in magnum-capi-helm unit tests after [1]. [1]: https://review.opendev.org/c/openstack/magnum/+/927446 Closes-Bug: #2089934 Change-Id: I3e5560dd487525d9566930772b0c56d52d974500 (cherry picked from commit ea2619f462281bea9d5304bcf6cbabfc1af2cfb8) --- magnum/db/sqlalchemy/api.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/magnum/db/sqlalchemy/api.py b/magnum/db/sqlalchemy/api.py index 5b5f0ac451..05c93fe3cf 100644 --- a/magnum/db/sqlalchemy/api.py +++ b/magnum/db/sqlalchemy/api.py @@ -64,7 +64,8 @@ def _session_for_write(): def _wrap_session(session): - if CONF.profiler.enabled and CONF.profiler.trace_sqlalchemy: + if (hasattr(CONF, 'profiler') and CONF.profiler.enabled and + CONF.profiler.trace_sqlalchemy): session = profiler_sqlalchemy.wrap_session(sa, session) return session