]> git.ipfire.org Git - thirdparty/knot-resolver.git/commitdiff
manager: improved logging of subprocess controller selection
authorVasek Sraier <git@vakabus.cz>
Sun, 17 Apr 2022 15:11:39 +0000 (17:11 +0200)
committerVasek Sraier <git@vakabus.cz>
Sun, 17 Apr 2022 15:11:39 +0000 (17:11 +0200)
manager/knot_resolver_manager/kresd_controller/__init__.py
manager/knot_resolver_manager/kresd_controller/systemd/__init__.py

index c42169bc32f17102c27af931615c926bf6a3b6c3..c2604fa11e7e3d53c1175dd538fba70a8c4afc14 100644 (file)
@@ -51,7 +51,7 @@ def try_systemd():
 
 
 async def get_best_controller_implementation(config: KresConfig) -> SubprocessController:
-    logger.debug("Starting service manager auto-selection...")
+    logger.info("Starting service manager auto-selection...")
 
     if len(_registered_controllers) == 0:
         logger.error("No controllers are available! Did you install all dependencies?")
@@ -59,6 +59,10 @@ async def get_best_controller_implementation(config: KresConfig) -> SubprocessCo
 
     # check all controllers concurrently
     res = await asyncio.gather(*(cont.is_controller_available(config) for cont in _registered_controllers))
+    logger.info(
+        "Available subprocess controllers are %s",
+        str(tuple((str(c) for r, c in zip(res, _registered_controllers) if r))),
+    )
 
     # take the first one on the list which is available
     for avail, controller in zip(res, _registered_controllers):
index a5550accc7fe5ebc6bb49b28d1d0be163d5a2e5d..b0070b4283092478a656665ef4c67d57a1af325f 100644 (file)
@@ -109,7 +109,7 @@ class SystemdSubprocessController(SubprocessController):
         cmd = f"systemctl {'--user' if self._systemd_type == SystemdType.SESSION else ''} status"
         ret = await call(cmd, shell=True, discard_output=True)
         if ret != 0:
-            logger.info(
+            logger.debug(
                 "Calling '%s' failed. Assumming systemd (%s) is not running/installed.", cmd, self._systemd_type
             )
             return False
@@ -117,7 +117,7 @@ class SystemdSubprocessController(SubprocessController):
         # check that we run under root for non-session systemd
         try:
             if self._systemd_type is SystemdType.SYSTEM and os.geteuid() != 0:
-                logger.info(
+                logger.debug(
                     "Systemd (%s) looks functional, but we are not running as root. Assuming not enough privileges",
                     self._systemd_type,
                 )
@@ -125,7 +125,7 @@ class SystemdSubprocessController(SubprocessController):
 
             return True
         except BaseException:  # we want every possible exception to be caught
-            logger.warning("Communicating with systemd DBus API failed", exc_info=True)
+            logger.warning("Systemd autodetection error: communicating with systemd DBus API failed", exc_info=True)
             return False
 
     async def get_all_running_instances(self) -> Iterable[Subprocess]: