mirror of
https://github.com/mail-in-a-box/mailinabox.git
synced 2024-12-24 07:37:04 +00:00
simplify utils.py#shell method used by unbound-control call
This commit is contained in:
parent
16728860f4
commit
210d9f08dc
@ -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.
|
# Clear unbound's DNS cache so our own DNS resolver is up to date.
|
||||||
# (ignore errors with trap=True)
|
# (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 len(updated_domains) == 0:
|
||||||
# if nothing was updated (except maybe DKIM's files), don't show any output
|
# if nothing was updated (except maybe DKIM's files), don't show any output
|
||||||
|
@ -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
|
# clear unbound's DNS cache so our DNS checks are up to date
|
||||||
# (ignore errors; if unbound isn't running we'd already report
|
# (ignore errors; if unbound isn't running we'd already report
|
||||||
# that in run_services checks.)
|
# 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)
|
run_system_checks(rounded_values, env, output)
|
||||||
|
|
||||||
|
@ -106,7 +106,7 @@ def sort_email_addresses(email_addresses, env):
|
|||||||
ret.extend(sorted(email_addresses)) # whatever is left
|
ret.extend(sorted(email_addresses)) # whatever is left
|
||||||
return ret
|
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.
|
# A safe way to execute processes.
|
||||||
# Some processes like apt-get require being given a sane PATH.
|
# Some processes like apt-get require being given a sane PATH.
|
||||||
import subprocess
|
import subprocess
|
||||||
@ -116,8 +116,6 @@ def shell(method, cmd_args, env={}, capture_stdout=True, capture_stderr=False, r
|
|||||||
'env': env,
|
'env': env,
|
||||||
'stderr': None if not capture_stderr else subprocess.STDOUT,
|
'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:
|
if method == "check_output" and input is not None:
|
||||||
kwargs['input'] = input
|
kwargs['input'] = input
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user