simplify utils.py#shell method used by unbound-control call

This commit is contained in:
KiekerJan 2022-11-05 21:04:05 +01:00
parent 16728860f4
commit 210d9f08dc
3 changed files with 3 additions and 5 deletions

View File

@ -127,7 +127,7 @@ def do_dns_update(env, force=False):
# Clear unbound's DNS cache so our own DNS resolver is up to date.
# (ignore errors with trap=True)
shell('check_call', ["/usr/sbin/unbound-control", "flush_zone", "."], trap=True, capture_stdout=False)
shell('check_call', ["/usr/sbin/unbound-control", "flush_zone", ".", "-q"], trap=True)
if len(updated_domains) == 0:
# if nothing was updated (except maybe DKIM's files), don't show any output

View File

@ -58,7 +58,7 @@ def run_checks(rounded_values, env, output, pool, domains_to_check=None):
# clear unbound's DNS cache so our DNS checks are up to date
# (ignore errors; if unbound isn't running we'd already report
# that in run_services checks.)
shell('check_call', ["/usr/sbin/unbound-control", "flush_zone", "."], trap=True, capture_stdout=False)
shell('check_call', ["/usr/sbin/unbound-control", "flush_zone", ".", "-q"], trap=True)
run_system_checks(rounded_values, env, output)

View File

@ -106,7 +106,7 @@ def sort_email_addresses(email_addresses, env):
ret.extend(sorted(email_addresses)) # whatever is left
return ret
def shell(method, cmd_args, env={}, capture_stdout=True, capture_stderr=False, return_bytes=False, trap=False, input=None):
def shell(method, cmd_args, env={}, capture_stderr=False, return_bytes=False, trap=False, input=None):
# A safe way to execute processes.
# Some processes like apt-get require being given a sane PATH.
import subprocess
@ -116,8 +116,6 @@ def shell(method, cmd_args, env={}, capture_stdout=True, capture_stderr=False, r
'env': env,
'stderr': None if not capture_stderr else subprocess.STDOUT,
}
if not capture_stdout:
kwargs['stdout'] = subprocess.DEVNULL
if method == "check_output" and input is not None:
kwargs['input'] = input