summaryrefslogtreecommitdiff
path: root/src/conf_mode/vrrp.py
diff options
context:
space:
mode:
authorThomas Mangin <thomas.mangin@exa.net.uk>2020-04-09 19:08:24 +0100
committerGitHub <noreply@github.com>2020-04-09 20:08:24 +0200
commit9875a21bdb26df19f2faf3e81153dea15e4f9e3c (patch)
tree8a1ecc1b318d80db156f397c34bc75f40c184728 /src/conf_mode/vrrp.py
parentc8a86d3ccee63b972c36346e6cb1c712c6801ad2 (diff)
downloadvyos-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/vrrp.py')
-rwxr-xr-xsrc/conf_mode/vrrp.py8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/conf_mode/vrrp.py b/src/conf_mode/vrrp.py
index d3e3710d1..3f1b73385 100755
--- a/src/conf_mode/vrrp.py
+++ b/src/conf_mode/vrrp.py
@@ -27,7 +27,7 @@ import vyos.keepalived
from vyos.defaults import directories as vyos_data_dir
from vyos import ConfigError
-from vyos.util import run
+from vyos.util import call
daemon_file = "/etc/default/keepalived"
config_file = "/etc/keepalived/keepalived.conf"
@@ -242,17 +242,17 @@ def apply(data):
if not vyos.keepalived.vrrp_running():
print("Starting the VRRP process")
- ret = run("sudo systemctl restart keepalived.service")
+ ret = call("sudo systemctl restart keepalived.service")
else:
print("Reloading the VRRP process")
- ret = run("sudo systemctl reload keepalived.service")
+ ret = call("sudo systemctl reload keepalived.service")
if ret != 0:
raise ConfigError("keepalived failed to start")
else:
# VRRP is removed in the commit
print("Stopping the VRRP process")
- run("sudo systemctl stop keepalived.service")
+ call("sudo systemctl stop keepalived.service")
os.unlink(config_file)
return None