]> git.ipfire.org Git - thirdparty/knot-resolver.git/commitdiff
manager: config_store: renew with old config docs-develop-mana-x3u7hn/deployments/4525
authorAleš Mrázek <ales.mrazek@nic.cz>
Wed, 3 Jul 2024 05:06:55 +0000 (07:06 +0200)
committerVladimír Čunát <vladimir.cunat@nic.cz>
Thu, 11 Jul 2024 09:49:43 +0000 (11:49 +0200)
manager/knot_resolver_manager/config_store.py
manager/knot_resolver_manager/kres_manager.py

index b4e2d62c899f1b9a46df04269cd0c4041132d2bd..e5fbaf60db12b55ab1d8e8ed5a65e124080e8bcb 100644 (file)
@@ -27,9 +27,7 @@ class ConfigStore:
         err_res = filter(lambda r: r.is_err(), results)
         errs = list(map(lambda r: r.unwrap_err(), err_res))
         if len(errs) > 0:
-            raise KresManagerException(
-                "Validation of the new config failed. The reasons are:\n - " + "\n - ".join(errs)
-            )
+            raise KresManagerException("Configuration validation failed. The reasons are:\n - " + "\n - ".join(errs))
 
         async with self._update_lock:
             # update the stored config with the new version
@@ -39,6 +37,9 @@ class ConfigStore:
             for call in self._callbacks:
                 await call(config)
 
+    async def renew(self) -> None:
+        await self.update(self._config)
+
     async def register_verifier(self, verifier: VerifyCallback) -> None:
         self._verifiers.append(verifier)
         res = await verifier(self.get(), self.get())
index 6682d9262c8f021e0773155a71aa3e65210905ce..1090ad5dbc197d317d513998e356ebbeaf7b1983 100644 (file)
@@ -337,9 +337,7 @@ class KresManager:  # pylint: disable=too-many-instance-attributes
             self._fix_counter.increase()
             await self._reload_system_state()
             logger.warning("Workers reloaded. Applying old config....")
-            old_config = self._config_store.get()
-            await self.load_policy_rules(old_config, old_config)
-            await self.apply_config(old_config, _noretry=True)
+            await self._config_store.renew()
             logger.warning(f"System stability hopefully renewed. Fix attempt counter is currently {self._fix_counter}")
         except BaseException:
             logger.error("Failed attempting to fix an error. Forcefully shutting down.", exc_info=True)