diff options
author | Thomas Mangin <thomas.mangin@exa.net.uk> | 2020-04-05 14:36:29 +0100 |
---|---|---|
committer | Thomas Mangin <thomas.mangin@exa.net.uk> | 2020-04-06 20:22:35 +0100 |
commit | aceb0817a65bf01669cada3ceb60d65b81607bc3 (patch) | |
tree | 5418d4537cfc14115536315909fbb7a83277fe7a /src/op_mode/restart_dhcp_relay.py | |
parent | 356950579c2b155f9d41c04ed63c7efde561b43a (diff) | |
download | vyos-1x-aceb0817a65bf01669cada3ceb60d65b81607bc3.tar.gz vyos-1x-aceb0817a65bf01669cada3ceb60d65b81607bc3.zip |
util: T2226: covert most calls from os.system to util
As little change a possible but the function call
The behaviour should be totally unchanged.
Diffstat (limited to 'src/op_mode/restart_dhcp_relay.py')
-rwxr-xr-x | src/op_mode/restart_dhcp_relay.py | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/src/op_mode/restart_dhcp_relay.py b/src/op_mode/restart_dhcp_relay.py index ab02d1eb3..057b4dcd8 100755 --- a/src/op_mode/restart_dhcp_relay.py +++ b/src/op_mode/restart_dhcp_relay.py @@ -23,6 +23,8 @@ import argparse import os import vyos.config +from vyos.util import run + parser = argparse.ArgumentParser() parser.add_argument("--ipv4", action="store_true", help="Restart IPv4 DHCP relay") @@ -37,7 +39,7 @@ if __name__ == '__main__': if not c.exists_effective('service dhcp-relay'): print("DHCP relay service not configured") else: - os.system('sudo systemctl restart isc-dhcp-relay.service') + run('sudo systemctl restart isc-dhcp-relay.service') sys.exit(0) elif args.ipv6: @@ -45,7 +47,7 @@ if __name__ == '__main__': if not c.exists_effective('service dhcpv6-relay'): print("DHCPv6 relay service not configured") else: - os.system('sudo systemctl restart isc-dhcpv6-relay.service') + run('sudo systemctl restart isc-dhcpv6-relay.service') sys.exit(0) else: |