From ad4664b9ac38aca65903272e2a98e9a7f718546f Mon Sep 17 00:00:00 2001 From: Pavlo Shchelokovskyy Date: Tue, 21 Nov 2023 17:54:21 +0000 Subject: [PATCH] Drop before_first_request usage of Flask app Flask 2.3 removed this method, with recommended way of running startup actions explicitly as part of app initialization. Change-Id: I5dea1320c9aa63c1ef1742382cb46ea7cc56b10b --- ironic_inspector/main.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/ironic_inspector/main.py b/ironic_inspector/main.py index 64d76f3b3..519f511e0 100644 --- a/ironic_inspector/main.py +++ b/ironic_inspector/main.py @@ -78,8 +78,10 @@ def _init_middleware(): def get_app(): """Get the flask instance.""" - _init_middleware() - return _app + with _app.app_context(): + _init_middleware() + start_coordinator() + return _app # TODO(kaifeng) Extract rpc related code into a rpcapi module @@ -196,7 +198,6 @@ def convert_exceptions(func): return wrapper -@_app.before_first_request def start_coordinator(): """Create a coordinator instance for non-standalone case.""" if not CONF.standalone: