From: Aleš Mrázek Date: Wed, 3 Jul 2024 05:06:55 +0000 (+0200) Subject: manager: config_store: renew with old config X-Git-Tag: v6.0.8~6^2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=refs%2Fenvironments%2Fdocs-develop-mana-x3u7hn%2Fdeployments%2F4525;p=thirdparty%2Fknot-resolver.git manager: config_store: renew with old config --- diff --git a/manager/knot_resolver_manager/config_store.py b/manager/knot_resolver_manager/config_store.py index b4e2d62c8..e5fbaf60d 100644 --- a/manager/knot_resolver_manager/config_store.py +++ b/manager/knot_resolver_manager/config_store.py @@ -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()) diff --git a/manager/knot_resolver_manager/kres_manager.py b/manager/knot_resolver_manager/kres_manager.py index 6682d9262..1090ad5db 100644 --- a/manager/knot_resolver_manager/kres_manager.py +++ b/manager/knot_resolver_manager/kres_manager.py @@ -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)