From: Aleš Mrázek Date: Tue, 7 Oct 2025 11:47:53 +0000 (+0200) Subject: client: reload: added --force flag X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=e6296843cfa3c73f72c1f872fc9b594cde0981a6;p=thirdparty%2Fknot-resolver.git client: reload: added --force flag --- diff --git a/doc/user/manager-client.rst b/doc/user/manager-client.rst index 68acc9dcf..5978caabb 100644 --- a/doc/user/manager-client.rst +++ b/doc/user/manager-client.rst @@ -313,6 +313,10 @@ single ``kresctl`` command. Requires a connection to the management API. + .. option:: --force + + Force a reload, even if the configuration hasn't changed. + .. option:: stop diff --git a/python/knot_resolver/client/commands/reload.py b/python/knot_resolver/client/commands/reload.py index c1350fc55..26d0a24f6 100644 --- a/python/knot_resolver/client/commands/reload.py +++ b/python/knot_resolver/client/commands/reload.py @@ -10,6 +10,7 @@ from knot_resolver.utils.requests import request class ReloadCommand(Command): def __init__(self, namespace: argparse.Namespace) -> None: super().__init__(namespace) + self.force: bool = namespace.force @staticmethod def register_args_subparser( @@ -21,7 +22,12 @@ class ReloadCommand(Command): " Old processes are replaced by new ones (with updated configuration) using rolling restarts." " So there will be no DNS service unavailability during reload operation.", ) - + reload.add_argument( + "--force", + help="Force a reload, even if the configuration hasn't changed.", + action="store_true", + default=False, + ) return reload, ReloadCommand @staticmethod @@ -29,7 +35,7 @@ class ReloadCommand(Command): return {} def run(self, args: CommandArgs) -> None: - response = request(args.socket, "POST", "reload") + response = request(args.socket, "POST", "reload/force" if self.force else "reload") if response.status != 200: print(response, file=sys.stderr)