summaryrefslogtreecommitdiff
path: root/src/conf_mode/service-pppoe.py
diff options
context:
space:
mode:
authorThomas Mangin <thomas.mangin@exa.net.uk>2020-04-05 16:56:41 +0100
committerThomas Mangin <thomas.mangin@exa.net.uk>2020-04-06 20:22:35 +0100
commitc51b8f3e2fe1a8425fba2d3eb9c07049ef9b22bb (patch)
tree48514654e5b44b50002dbc4a0e0b70ce4e00cdd7 /src/conf_mode/service-pppoe.py
parent4b30d3d6545b108c0b043baae2d57a465a8c8999 (diff)
downloadvyos-1x-c51b8f3e2fe1a8425fba2d3eb9c07049ef9b22bb.tar.gz
vyos-1x-c51b8f3e2fe1a8425fba2d3eb9c07049ef9b22bb.zip
util: T2226: rewrite conf accel-ppp commands to use cmd
Diffstat (limited to 'src/conf_mode/service-pppoe.py')
-rwxr-xr-xsrc/conf_mode/service-pppoe.py16
1 files changed, 4 insertions, 12 deletions
diff --git a/src/conf_mode/service-pppoe.py b/src/conf_mode/service-pppoe.py
index afcc5ba99..d3fc82406 100755
--- a/src/conf_mode/service-pppoe.py
+++ b/src/conf_mode/service-pppoe.py
@@ -16,7 +16,6 @@
import os
import re
-import subprocess
from jinja2 import FileSystemLoader, Environment
from socket import socket, AF_INET, SOCK_STREAM
@@ -26,6 +25,7 @@ from time import sleep
from vyos.config import Config
from vyos.defaults import directories as vyos_data_dir
from vyos import ConfigError
+from vyos.util import run
pidfile = r'/var/run/accel_pppoe.pid'
pppoe_cnf_dir = r'/etc/accel-ppp/pppoe'
@@ -57,15 +57,8 @@ def _chk_con():
raise("failed to start pppoe server")
-def _accel_cmd(cmd=''):
- if not cmd:
- return None
- try:
- ret = subprocess.check_output(
- ['/usr/bin/accel-cmd', cmd]).decode().strip()
- return ret
- except:
- return 1
+def _accel_cmd(command):
+ return run(f'/usr/bin/accel-cmd {command}')
def get_config():
@@ -426,8 +419,7 @@ def apply(c):
return None
if not os.path.exists(pidfile):
- ret = subprocess.call(
- ['/usr/sbin/accel-pppd', '-c', pppoe_conf, '-p', pidfile, '-d'])
+ ret = run(f'/usr/sbin/accel-pppd -c {pppoe_conf} -p {pidfile} -d')
_chk_con()
if ret != 0 and os.path.exists(pidfile):
os.remove(pidfile)