]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
Add Dig interface
authorMichal Nowak <mnowak@isc.org>
Fri, 7 Feb 2025 10:26:04 +0000 (11:26 +0100)
committerMichal Nowak <mnowak@isc.org>
Mon, 17 Feb 2025 19:27:53 +0000 (20:27 +0100)
(cherry picked from commit 7347abd01f38ac77916c1ce8fb1cfff91d32aa94)

bin/tests/system/isctest/run.py

index 09eec761272491b4584083f1c51606b55b5ec65c..cdf0029b8ee9b831b571e4890c35f9314a0b9eb9 100644 (file)
@@ -65,6 +65,18 @@ def cmd(
         return exc
 
 
+class Dig:
+    def __init__(self, base_params: str = ""):
+        self.base_params = base_params
+
+    def __call__(self, params: str) -> str:
+        """Run the dig command with the given parameters and return the decoded output."""
+        return cmd(
+            [os.environ.get("DIG")] + f"{self.base_params} {params}".split(),
+            log_stdout=True,
+        ).stdout.decode("utf-8")
+
+
 def retry_with_timeout(func, timeout, delay=1, msg=None):
     start_time = time.time()
     while time.time() < start_time + timeout: