From 27945d1655a7ee84a7e796a2b80c48c775b20370 Mon Sep 17 00:00:00 2001 From: Takashi Kajinami Date: Tue, 17 Mar 2026 18:12:23 +0900 Subject: [PATCH] Use consistent program name Make sure that the consistent program name is always set,so that the same config sub-directory ( /etc/{project}/{prog}.conf.d ) is used after migration to WSGI server + entry point. Closes-Bug: #2098514 Change-Id: I71361ebbc5c76bd92e0b181704f22cf2f4df5241 Signed-off-by: Takashi Kajinami --- neutron/server/__init__.py | 9 +++++---- neutron/wsgi/api.py | 2 +- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/neutron/server/__init__.py b/neutron/server/__init__.py index 21fe9683690..9c3dd1066c4 100644 --- a/neutron/server/__init__.py +++ b/neutron/server/__init__.py @@ -46,11 +46,12 @@ def _get_config_files(env=None): return [os.path.join(dirname, fname) for fname in files] -def _init_configuration(): +def _init_configuration(prog=None): # the configuration will be read into the cfg.CONF global data structure conf_files = _get_config_files() config.register_common_config_options() - config.init(sys.argv[1:], default_config_files=conf_files) + config.init(sys.argv[1:], default_config_files=conf_files, + prog=prog) config.setup_logging() config.set_config_defaults() if not cfg.CONF.config_file: @@ -59,7 +60,7 @@ def _init_configuration(): " the '--config-file' option!")) -def boot_server(server_func): +def boot_server(server_func, prog=None): # During the call to gmr.TextGuruMeditation.setup_autorun(), Guru # Meditation Report tries to start logging. # Set a handler here to accommodate this. @@ -71,7 +72,7 @@ def boot_server(server_func): if not logger.handlers: logger.addHandler(sys_logging.StreamHandler()) - _init_configuration() + _init_configuration(prog=prog) config.setup_gmr() try: return server_func() diff --git a/neutron/wsgi/api.py b/neutron/wsgi/api.py index 16f8f6391b1..8bfa53648c7 100644 --- a/neutron/wsgi/api.py +++ b/neutron/wsgi/api.py @@ -20,4 +20,4 @@ application = None lock = threading.Lock() with lock: if application is None: - application = server.boot_server(api.api_server) + application = server.boot_server(api.api_server, prog='neutron-api')