summaryrefslogtreecommitdiff
path: root/src/conf_mode/system-option.py
diff options
context:
space:
mode:
authorChristian Poessinger <christian@poessinger.com>2021-07-30 20:19:10 +0200
committerChristian Poessinger <christian@poessinger.com>2021-07-30 20:19:10 +0200
commitec713e585ace09beb9942d928e0099a35dcdd0f2 (patch)
treee19dd2d90d1762a9ae8983f7aa3a00669fe0cda4 /src/conf_mode/system-option.py
parentf520182b56e34428e9d9491ba062025cc9bea971 (diff)
downloadvyos-1x-ec713e585ace09beb9942d928e0099a35dcdd0f2.tar.gz
vyos-1x-ec713e585ace09beb9942d928e0099a35dcdd0f2.zip
vyos.util: drop custom implementations in favor of is_systemd_service_running()
Commit f520182b ("vyos.util: add is_systemd_service_running() helper function") added a new helper function that can be used to check if a systemd service is running. Drop all custom implementations in favor of this library call.
Diffstat (limited to 'src/conf_mode/system-option.py')
-rwxr-xr-xsrc/conf_mode/system-option.py3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/conf_mode/system-option.py b/src/conf_mode/system-option.py
index 454611c55..55cf6b142 100755
--- a/src/conf_mode/system-option.py
+++ b/src/conf_mode/system-option.py
@@ -24,6 +24,7 @@ from vyos.config import Config
from vyos.configdict import dict_merge
from vyos.template import render
from vyos.util import cmd
+from vyos.util import is_systemd_service_running
from vyos.validate import is_addr_assigned
from vyos.xml import defaults
from vyos import ConfigError
@@ -114,7 +115,7 @@ def apply(options):
if 'performance' in options:
cmd('systemctl restart tuned.service')
# wait until daemon has started before sending configuration
- while (int(os.system('systemctl is-active --quiet tuned.service')) != 0):
+ while (not is_systemd_service_running('tuned.service')):
sleep(0.250)
cmd('tuned-adm profile network-{performance}'.format(**options))
else: