]> git.ipfire.org Git - thirdparty/knot-resolver.git/commitdiff
manager: server: handle SubprocessControllerError during init
authorAleš Mrázek <ales.mrazek@nic.cz>
Thu, 30 Jan 2025 10:01:01 +0000 (11:01 +0100)
committerAleš Mrázek <ales.mrazek@nic.cz>
Wed, 5 Feb 2025 22:05:19 +0000 (23:05 +0100)
python/knot_resolver/controller/supervisord/__init__.py
python/knot_resolver/manager/server.py

index ddb9b29b1265b9fd91883963217e45c171094b7e..aa85fc305a81fc54ed53aa0e98fe5fc49fd09208 100644 (file)
@@ -53,7 +53,7 @@ async def _reload_supervisord(config: KresConfig) -> None:
         supervisord = _create_supervisord_proxy(config)
         supervisord.reloadConfig()
     except Fault as e:
-        raise SubprocessControllerError("supervisord reload failed") from e
+        raise SubprocessControllerError(f"supervisord reload failed: {e}") from e
 
 
 @async_in_a_thread
index 06fab0cfce5b3beeca76f57f26f5d070e3315332..879ce80e49995f03b222dd76b380d610d9810f80 100644 (file)
@@ -20,7 +20,7 @@ from aiohttp.web_runner import AppRunner, TCPSite, UnixSite
 
 from knot_resolver.constants import CONFIG_FILE, USER
 from knot_resolver.controller import get_best_controller_implementation
-from knot_resolver.controller.exceptions import SubprocessControllerExecError
+from knot_resolver.controller.exceptions import SubprocessControllerError, SubprocessControllerExecError
 from knot_resolver.controller.interface import SubprocessType
 from knot_resolver.controller.registered_workers import command_single_registered_worker
 from knot_resolver.datamodel import kres_config_json_schema
@@ -611,6 +611,10 @@ async def start_server(config: Path = CONFIG_FILE) -> int:  # noqa: PLR0915
         # and finally exec what we were told to exec
         os.execl(*e.exec_args)
 
+    except SubprocessControllerError as e:
+        logger.error(f"Server initialization failed: {e}")
+        return 1
+
     except KresManagerException as e:
         # We caught an error with a pretty error message. Just print it and exit.
         logger.error(e)