summaryrefslogtreecommitdiff
path: root/src/conf_mode/le_cert.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/le_cert.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/le_cert.py')
-rwxr-xr-xsrc/conf_mode/le_cert.py4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/conf_mode/le_cert.py b/src/conf_mode/le_cert.py
index 755c89966..6e169a3d5 100755
--- a/src/conf_mode/le_cert.py
+++ b/src/conf_mode/le_cert.py
@@ -22,6 +22,7 @@ from vyos.config import Config
from vyos import ConfigError
from vyos.util import cmd
from vyos.util import call
+from vyos.util import is_systemd_service_running
from vyos import airbag
airbag.enable()
@@ -87,8 +88,7 @@ def generate(cert):
# certbot will attempt to reload nginx, even with 'certonly';
# start nginx if not active
- ret = call('systemctl is-active --quiet nginx.service')
- if ret:
+ if not is_systemd_service_running('nginx.service'):
call('systemctl start nginx.service')
request_certbot(cert)