From 503bdbd444d993ddee0687e7ef5a51f3ad738b25 Mon Sep 17 00:00:00 2001 From: Daniil Baturin Date: Tue, 27 Jul 2021 06:02:03 -0500 Subject: T3697: wait for charon to get started before trying to restart it. --- src/conf_mode/ipsec-settings.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/conf_mode/ipsec-settings.py b/src/conf_mode/ipsec-settings.py index a475ca14a..cbe4ba376 100755 --- a/src/conf_mode/ipsec-settings.py +++ b/src/conf_mode/ipsec-settings.py @@ -222,9 +222,14 @@ def restart_ipsec(): # Since it's started by the legacy ipsec.pl in VyOS 1.3, # there's a chance that this script will run before charon is up, # so we can't assume it's running and have to check and wait if needed. + + # First, wait for charon to get started by the old ipsec.pl script. + wait_for_file_write_complete(charon_pidfile, timeout=120) + + # Now actually restart the daemon wait_for_file_write_complete(charon_pidfile, pre_hook=(lambda: call('ipsec restart >&/dev/null')), - timeout=10) + timeout=120) # Force configuration load call('swanctl -q >&/dev/null') -- cgit v1.2.3