]> git.ipfire.org Git - thirdparty/knot-resolver.git/commitdiff
bug fix of systemd startup
authorVasek Sraier <git@vakabus.cz>
Wed, 3 Nov 2021 11:06:36 +0000 (12:06 +0100)
committerAleš Mrázek <ales.mrazek@nic.cz>
Fri, 8 Apr 2022 14:17:53 +0000 (16:17 +0200)
Cache service was not being loaded as running due to a name mismatch.

manager/knot_resolver_manager/kresd_controller/systemd/__init__.py
manager/knot_resolver_manager/kresd_controller/systemd/dbus_api.py
manager/knot_resolver_manager/server.py

index 9d3209d708a8e500e85b6685e5f466e2b1c7cde7..8c6bfd33ac097d8116fcaef1a6bd266c675e49a7 100644 (file)
@@ -134,7 +134,7 @@ class SystemdSubprocessController(SubprocessController):
                         self._systemd_type,
                     )
                 )
-            elif unit.name == "kres-cache-gc.service":
+            elif unit.name == systemd.GC_SERVICE_NAME:
                 # we can't easily check, if the unit is transient or not without additional systemd call
                 # we ignore it for now and assume the default persistency state. It shouldn't cause any
                 # problems, because interactions with the process are done the same way in all cases
index b926dba49c22e8995a0296218b7a7893f2b28fb5..2e46fbae23fc8fa05439578236a6ff3e0d406413 100644 (file)
@@ -21,6 +21,8 @@ from knot_resolver_manager.kresd_controller.interface import SubprocessType
 
 logger = logging.getLogger(__name__)
 
+GC_SERVICE_NAME = "kres-managed-cache-gc.service"
+
 
 class SystemdType(Enum):
     SYSTEM = auto()
@@ -189,7 +191,7 @@ def start_transient_kresd_unit(
 ):
     name, properties = {
         SubprocessType.KRESD: (f"kresd_{kres_id}.service", _kresd_unit_properties(config, kres_id)),
-        SubprocessType.GC: ("kres-managed-cache-gc.service", _gc_unit_properties(config)),
+        SubprocessType.GC: (GC_SERVICE_NAME, _gc_unit_properties(config)),
     }[subprocess_type]
 
     systemd = _create_manager_proxy(type_)
index 4424110a5fa4b184ee6798179e360d46c1eac817..320f7bfdd30ae2621148ae670dd94a0b3b939483 100644 (file)
@@ -128,7 +128,8 @@ class Server:
         service, we can fix it. But we are not guaranteeing, that this will always work.
         """
 
-        return web.Response(text="""
+        return web.Response(
+            text="""
         <html>
         <head><title>Redirect to schema viewer</title></head>
         <body>
@@ -142,7 +143,9 @@ class Server:
         <h1>JavaScript required for a dynamic redirect...</h1>
         </body>
         </html>
-        """, content_type="text/html")
+        """,
+            content_type="text/html",
+        )
 
     def _set_log_level(self, config: KresConfig):
         if self.log_level != config.server.management.log_level: