From 1c85a72fc338dab5266cff6faffd12f1505512c9 Mon Sep 17 00:00:00 2001 From: Thomas Mangin Date: Sun, 5 Apr 2020 17:34:33 +0100 Subject: util: T2226: rewrite syslog to use run --- src/conf_mode/system-syslog.py | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) (limited to 'src/conf_mode/system-syslog.py') diff --git a/src/conf_mode/system-syslog.py b/src/conf_mode/system-syslog.py index 8c0a6629c..915a631ec 100755 --- a/src/conf_mode/system-syslog.py +++ b/src/conf_mode/system-syslog.py @@ -24,6 +24,7 @@ from vyos.config import Config from vyos.defaults import directories as vyos_data_dir from vyos.util import subprocess_cmd from vyos import ConfigError +from vyos.util import run def get_config(): c = Config() @@ -253,10 +254,8 @@ def verify(c): def apply(c): if not c: - subprocess_cmd('systemctl stop syslog') - return None - - subprocess_cmd('systemctl restart syslog') + return run('systemctl stop syslog') + return run('systemctl restart syslog') if __name__ == '__main__': try: -- cgit v1.2.3 From 7256810914e6664bf92041dcd7c3daf649ce0001 Mon Sep 17 00:00:00 2001 From: Thomas Mangin Date: Sun, 5 Apr 2020 23:08:09 +0100 Subject: util: T2226: remove all references to subprocess_cmd --- python/vyos/util.py | 8 -------- src/conf_mode/system-syslog.py | 1 - src/conf_mode/vpn_sstp.py | 2 +- 3 files changed, 1 insertion(+), 10 deletions(-) (limited to 'src/conf_mode/system-syslog.py') diff --git a/python/vyos/util.py b/python/vyos/util.py index e0030d1bd..fa2b4dd99 100644 --- a/python/vyos/util.py +++ b/python/vyos/util.py @@ -89,14 +89,6 @@ def cmd(command, section='', shell=None, input=None, timeout=None, env=None, uni return decoded -# This is now deprecated -def subprocess_cmd(command): - """ execute arbitrary command via Popen """ - from subprocess import Popen, PIPE - p = Popen(command, stdout=PIPE, shell=True) - p.communicate() - - # file manipulation diff --git a/src/conf_mode/system-syslog.py b/src/conf_mode/system-syslog.py index 915a631ec..25b9b5bed 100755 --- a/src/conf_mode/system-syslog.py +++ b/src/conf_mode/system-syslog.py @@ -22,7 +22,6 @@ from sys import exit from vyos.config import Config from vyos.defaults import directories as vyos_data_dir -from vyos.util import subprocess_cmd from vyos import ConfigError from vyos.util import run diff --git a/src/conf_mode/vpn_sstp.py b/src/conf_mode/vpn_sstp.py index d4fd0f4a3..ca0844c50 100755 --- a/src/conf_mode/vpn_sstp.py +++ b/src/conf_mode/vpn_sstp.py @@ -26,7 +26,7 @@ from jinja2 import FileSystemLoader, Environment from vyos.config import Config from vyos import ConfigError from vyos.defaults import directories as vyos_data_dir -from vyos.util import process_running, subprocess_cmd +from vyos.util import process_running from vyos.util import process_running, cmd, run pidfile = r'/var/run/accel_sstp.pid' -- cgit v1.2.3