diff options
author | Christian Poessinger <christian@poessinger.com> | 2021-12-01 16:08:04 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-12-01 16:08:04 +0100 |
commit | b654b7991d2ec1d9aa40554f471cb7740fabfb91 (patch) | |
tree | f79dd12963ceb6cb2ccfdb7f9e1d70b4ffcb6720 /src/conf_mode | |
parent | a05866e5301934f61a3c83550f91926e03bfc7b0 (diff) | |
parent | 9304b1409a53cc197ef4d8fa58e96e0542b01128 (diff) | |
download | vyos-1x-b654b7991d2ec1d9aa40554f471cb7740fabfb91.tar.gz vyos-1x-b654b7991d2ec1d9aa40554f471cb7740fabfb91.zip |
Merge pull request #1091 from DmitriyEshenko/sg-1x-29112021-01
openconnect: T3695: Add systemd service checker on commit
Diffstat (limited to 'src/conf_mode')
-rwxr-xr-x | src/conf_mode/vpn_openconnect.py | 12 |
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__': |