]> git.ipfire.org Git - thirdparty/pdns.git/commitdiff
Address PR comments and add console completion in new file
authorOliver Chen <oliver.chen@nokia-sbell.com>
Mon, 23 Jun 2025 12:00:35 +0000 (12:00 +0000)
committerOliver Chen <oliver.chen@nokia-sbell.com>
Mon, 23 Jun 2025 12:00:35 +0000 (12:00 +0000)
pdns/dnsdistdist/dnsdist-console-completion.cc
pdns/dnsdistdist/docs/reference/config.rst
regression-tests.dnsdist/test_HealthChecks.py

index 458d890533f57cc9a65c24ba6b949786b1ed18ce..f3342e8aa2ea5793ce9f0d0dc885fef84c5b8b36 100644 (file)
@@ -57,6 +57,7 @@ static std::vector<dnsdist::console::completion::ConsoleKeyword> s_consoleKeywor
   {"addLocal", true, R"(addr [, {doTCP=true, reusePort=false, tcpFastOpenQueueSize=0, interface="", cpus={}}])", "add `addr` to the list of addresses we listen on"},
   {"addMaintenanceCallback", true, "callback", "register a function to be called as part of the maintenance hook, every second"},
   {"addExitCallback", true, "callback", "register a function to be called when DNSdist exits"},
+  {"addServerStateChangeCallback", true, "callback", "register a function to be called when state changed for a given server"},
   {"addTLSLocal", true, "addr, certFile(s), keyFile(s) [,params]", "listen to incoming DNS over TLS queries on the specified address using the specified certificate (or list of) and key (or list of). The last parameter is a table"},
   {"AllowAction", true, "", "let these packets go through"},
   {"AllowResponseAction", true, "", "let these packets go through"},
index db7315cba9006a61ec1765f0699aa23c88cc8abe..beccb56e29931124118d042af05c639655fbb354 100644 (file)
@@ -2243,7 +2243,7 @@ Other functions
   Register a Lua function to be called when a server state changed during the health check process.
   The function should not block for a long period of time, as it would otherwise delay the execution of the other functions registered for this hook, as well as the execution of the health check process.
 
-  :param function callback: The function to be called. It returns no value and takes two parameters, first parameter is a string with format as the same as return from :func:`Server:getNameWithAddr()` to identify the server, second parameter is a bool value indicating server state is up if true else down.
+  :param function callback: The function to be called. It returns no value and takes two parameters: the first parameter is a string identifying the server, formatted as if returned by :func:`Server:getNameWithAddr()`, the second parameter is a boolean value indicating whether the server is up.
 
   .. code-block:: lua
 
index 4348d76b35be76c947affd9add9efee7a72cc305..50ec51235b38514b752fda897853c51939a01939 100644 (file)
@@ -625,14 +625,14 @@ class TestServerStateChange(HealthCheckTest):
 
         self.setDrop(True)
         time.sleep(2.5)
-        # up count no change, down count increased by 1
+        # up count did not change, down count increased by 1
         self.assertEqual(self.getBackendStatus(), 'down')
         self.assertEqual(self.getCount(nameAddr, True), 1)
         self.assertEqual(self.getCount(nameAddr, False), 1)
 
         self.setDrop(False)
         time.sleep(1.5)
-        # up count increased again, down count no change
+        # up count increased again, down count did not change
         self.assertEqual(self.getBackendStatus(), 'up')
         self.assertEqual(self.getCount(nameAddr, True), 2)
         self.assertEqual(self.getCount(nameAddr, False), 1)