summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Mangin <thomas.mangin@exa.net.uk>2020-04-05 16:59:39 +0100
committerThomas Mangin <thomas.mangin@exa.net.uk>2020-04-06 20:22:35 +0100
commit9ec2ebe444686fb4fd8d2a37bb1ef7c29eab65e4 (patch)
tree71fbdeef7fdf225d0d64292121124772b9782fcc
parent7468191e111cfbec2d3ba1d507114fc9e115e681 (diff)
downloadvyos-1x-9ec2ebe444686fb4fd8d2a37bb1ef7c29eab65e4.tar.gz
vyos-1x-9ec2ebe444686fb4fd8d2a37bb1ef7c29eab65e4.zip
util: T2226: rewrite arp to use cmd
-rwxr-xr-xsrc/conf_mode/arp.py7
1 files changed, 4 insertions, 3 deletions
diff --git a/src/conf_mode/arp.py b/src/conf_mode/arp.py
index aeca08432..3daa892d7 100755
--- a/src/conf_mode/arp.py
+++ b/src/conf_mode/arp.py
@@ -20,9 +20,9 @@ import sys
import os
import re
import syslog as sl
-import subprocess
from vyos.config import Config
+from vyos.util import run
from vyos import ConfigError
arp_cmd = '/usr/sbin/arp'
@@ -82,11 +82,12 @@ def generate(c):
def apply(c):
for ip_addr in c['remove']:
sl.syslog(sl.LOG_NOTICE, "arp -d " + ip_addr)
- subprocess.call([arp_cmd + ' -d ' + ip_addr + ' >/dev/null 2>&1'], shell=True)
+ run(f'{arp_cmd} -d {ip_addr} >/dev/null 2>&1')
for ip_addr in c['update']:
sl.syslog(sl.LOG_NOTICE, "arp -s " + ip_addr + " " + c['update'][ip_addr])
- subprocess.call([arp_cmd + ' -s ' + ip_addr + ' ' + c['update'][ip_addr] ], shell=True)
+ updated = c['update'][ip_addr]
+ run(f'{arp_cmd} -s {ip_addr} {updated}')
if __name__ == '__main__':