diff options
author | Thomas Mangin <thomas.mangin@exa.net.uk> | 2020-04-09 19:08:24 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-04-09 20:08:24 +0200 |
commit | 9875a21bdb26df19f2faf3e81153dea15e4f9e3c (patch) | |
tree | 8a1ecc1b318d80db156f397c34bc75f40c184728 /src/conf_mode/le_cert.py | |
parent | c8a86d3ccee63b972c36346e6cb1c712c6801ad2 (diff) | |
download | vyos-1x-9875a21bdb26df19f2faf3e81153dea15e4f9e3c.tar.gz vyos-1x-9875a21bdb26df19f2faf3e81153dea15e4f9e3c.zip |
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.
Diffstat (limited to 'src/conf_mode/le_cert.py')
-rwxr-xr-x | src/conf_mode/le_cert.py | 11 |
1 files changed, 6 insertions, 5 deletions
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: |