summaryrefslogtreecommitdiff
path: root/src/conf_mode
diff options
context:
space:
mode:
authorDmitriyEshenko <dmitriy.eshenko@vyos.io>2021-12-01 07:56:24 +0000
committerDmitriyEshenko <dmitriy.eshenko@vyos.io>2021-12-01 12:02:56 +0000
commit9304b1409a53cc197ef4d8fa58e96e0542b01128 (patch)
tree9872c64f2077b4ec420e3584d2656398fab126d0 /src/conf_mode
parentb675c8b6187c4b77759e3f96c9c92dd382dabeae (diff)
downloadvyos-1x-9304b1409a53cc197ef4d8fa58e96e0542b01128.tar.gz
vyos-1x-9304b1409a53cc197ef4d8fa58e96e0542b01128.zip
openconnect: T3695: Add systemd service checker on commit
Diffstat (limited to 'src/conf_mode')
-rwxr-xr-xsrc/conf_mode/vpn_openconnect.py12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/conf_mode/vpn_openconnect.py b/src/conf_mode/vpn_openconnect.py
index f6db196dc..51ea1f223 100755
--- a/src/conf_mode/vpn_openconnect.py
+++ b/src/conf_mode/vpn_openconnect.py
@@ -23,9 +23,11 @@ from vyos.pki import wrap_certificate
from vyos.pki import wrap_private_key
from vyos.template import render
from vyos.util import call
+from vyos.util import is_systemd_service_running
from vyos.xml import defaults
from vyos import ConfigError
from crypt import crypt, mksalt, METHOD_SHA512
+from time import sleep
from vyos import airbag
airbag.enable()
@@ -172,6 +174,16 @@ def apply(ocserv):
os.unlink(file)
else:
call('systemctl restart ocserv.service')
+ counter = 0
+ while True:
+ # exit early when service runs
+ if is_systemd_service_running("ocserv.service"):
+ break
+ sleep(0.250)
+ if counter > 5:
+ raise ConfigError('openconnect failed to start, check the logs for details')
+ break
+ counter += 1
if __name__ == '__main__':