mirror of
https://github.com/isc-projects/bind9.git
synced 2026-06-11 13:50:00 -04:00
parent
a946528023
commit
8cb3eb5d9d
1 changed files with 12 additions and 0 deletions
|
|
@ -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:
|
||||
|
|
|
|||
Loading…
Reference in a new issue