summaryrefslogtreecommitdiff
path: root/src/conf_mode/vrrp.py
diff options
context:
space:
mode:
authorChristian Poessinger <christian@poessinger.com>2020-04-07 08:27:36 +0200
committerGitHub <noreply@github.com>2020-04-07 08:27:36 +0200
commit09ad28b28c9ebd9308cfe9048686b3b0ef9cfd9c (patch)
tree6e7b0971ecd8859cff864b3ebb37f86f8ba288f5 /src/conf_mode/vrrp.py
parente0f13b79a669e7fc8cadac8757b2f5fbbf51dc99 (diff)
parent7256810914e6664bf92041dcd7c3daf649ce0001 (diff)
downloadvyos-1x-09ad28b28c9ebd9308cfe9048686b3b0ef9cfd9c.tar.gz
vyos-1x-09ad28b28c9ebd9308cfe9048686b3b0ef9cfd9c.zip
Merge pull request #307 from thomas-mangin/T2226
util: T2226: convert all call to use vyos.util.{popen, cmd, run}
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 8683faca7..d3e3710d1 100755
--- a/src/conf_mode/vrrp.py
+++ b/src/conf_mode/vrrp.py
@@ -15,7 +15,6 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
import os
-import subprocess
from sys import exit
from ipaddress import ip_address, ip_interface, IPv4Interface, IPv6Interface, IPv4Address, IPv6Address
@@ -28,6 +27,7 @@ import vyos.keepalived
from vyos.defaults import directories as vyos_data_dir
from vyos import ConfigError
+from vyos.util import run
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 = subprocess.call("sudo systemctl restart keepalived.service", shell=True)
+ ret = run("sudo systemctl restart keepalived.service")
else:
print("Reloading the VRRP process")
- ret = subprocess.call("sudo systemctl reload keepalived.service", shell=True)
+ ret = run("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")
- subprocess.call("sudo systemctl stop keepalived.service", shell=True)
+ run("sudo systemctl stop keepalived.service")
os.unlink(config_file)
return None