From 9875a21bdb26df19f2faf3e81153dea15e4f9e3c Mon Sep 17 00:00:00 2001 From: Thomas Mangin Date: Thu, 9 Apr 2020 19:08:24 +0100 Subject: util: T2226: os.system was wrongly converted to run os.system does print the ouput of the command, run() does not. A new function called call() does the printing and return the error code. --- src/conf_mode/le_cert.py | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) (limited to 'src/conf_mode/le_cert.py') diff --git a/src/conf_mode/le_cert.py b/src/conf_mode/le_cert.py index a4dbecbaa..4b365a566 100755 --- a/src/conf_mode/le_cert.py +++ b/src/conf_mode/le_cert.py @@ -22,7 +22,8 @@ import os import vyos.defaults from vyos.config import Config from vyos import ConfigError -from vyos.util import cmd, run +from vyos.util import cmd +from vyos.util import call vyos_conf_scripts_dir = vyos.defaults.directories['conf_mode'] @@ -85,17 +86,17 @@ def generate(cert): # certbot will attempt to reload nginx, even with 'certonly'; # start nginx if not active - ret = run('systemctl is-active --quiet nginx.ervice') + ret = call('systemctl is-active --quiet nginx.ervice') if ret: - run('sudo systemctl start nginx.service') + call('sudo systemctl start nginx.service') request_certbot(cert) def apply(cert): if cert is not None: - run('sudo systemctl restart certbot.timer') + call('sudo systemctl restart certbot.timer') else: - run('sudo systemctl stop certbot.timer') + call('sudo systemctl stop certbot.timer') return None for dep in dependencies: -- cgit v1.2.3