mirror of
https://github.com/freedombox/FreedomBox.git
synced 2026-11-29 08:25:10 +00:00
*: Use action_utils.run instead of subprocess.run
- This is to capture stdout and stderr and transmit that from privileged daemon back to the service to be displayed in HTML. Tests: - Unit tests and code checks pass. - Some of the modified actions work as expected. Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org> Reviewed-by: Veiko Aasa <veiko17@disroot.org>
This commit is contained in:
1 parent
355812c9f2
commit
61ff15a04f
36 files changed
+257
-244
No files matched your search
@@ -110,7 +110,7 @@ def _setup_firewall():
|
||||
def _is_tunplus_enabled():
|
||||
"""Return whether tun+ interface is already added."""
|
||||
try:
|
||||
process = subprocess.run(
|
||||
process = action_utils.run(
|
||||
['firewall-cmd', '--zone', 'internal', '--list-interfaces'],
|
||||
stdout=subprocess.PIPE, check=True)
|
||||
return 'tun+' in process.stdout.decode().strip().split()
|
||||
@@ -135,8 +135,8 @@ def _setup_firewall():
|
||||
|
||||
def _run_easy_rsa(args):
|
||||
"""Execute easy-rsa command with some default arguments."""
|
||||
return subprocess.run(['/usr/share/easy-rsa/easyrsa'] + args,
|
||||
cwd=KEYS_DIRECTORY, check=True)
|
||||
return action_utils.run(['/usr/share/easy-rsa/easyrsa'] + args,
|
||||
cwd=KEYS_DIRECTORY, check=True)
|
||||
|
||||
|
||||
def _write_easy_rsa_config():
|
||||
@@ -162,7 +162,7 @@ def _is_renewable(cert_name):
|
||||
if not cert_path.exists():
|
||||
return False
|
||||
|
||||
process = subprocess.run(
|
||||
process = action_utils.run(
|
||||
['openssl', 'x509', '-noout', '-enddate', '-in',
|
||||
str(cert_path)], check=True, stdout=subprocess.PIPE)
|
||||
date_string = process.stdout.decode().strip().partition('=')[2]
|
||||
|
||||
Reference in new issue
Block a user