summaryrefslogtreecommitdiff
path: root/src/conf_mode/vpn_openconnect.py
diff options
context:
space:
mode:
authorerkin <e.altunbas@vyos.io>2021-12-16 17:31:57 +0300
committererkin <e.altunbas@vyos.io>2021-12-16 17:31:57 +0300
commit95b91627a6065b720365c9ae7d124d85fc8e493d (patch)
tree1d743211400347d3847623fb0e17dd39dbfb604c /src/conf_mode/vpn_openconnect.py
parentdc8c230ad45a10be93fc2cd79c38ebb39fd0a148 (diff)
parent5a871f0dac024c7c0c59f1a1709543c4cc5e4f96 (diff)
downloadvyos-1x-95b91627a6065b720365c9ae7d124d85fc8e493d.tar.gz
vyos-1x-95b91627a6065b720365c9ae7d124d85fc8e493d.zip
Merge branch 'current' of https://github.com/erkin/vyos-1x into current
Diffstat (limited to 'src/conf_mode/vpn_openconnect.py')
-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__':