summaryrefslogtreecommitdiff
path: root/src/system
diff options
context:
space:
mode:
authorSander Klein <github@roedie.nl>2022-08-22 21:47:30 +0200
committerSander Klein <github@roedie.nl>2022-08-22 21:47:30 +0200
commited5fb0645367e4bd099fe12decbb515af1e6dcc6 (patch)
treed3045f2b1df4c473ff54ff818d78d78c23f3690c /src/system
parent26361076d2b4136dae9ba426c486430002b6e9ac (diff)
downloadvyos-1x-ed5fb0645367e4bd099fe12decbb515af1e6dcc6.tar.gz
vyos-1x-ed5fb0645367e4bd099fe12decbb515af1e6dcc6.zip
keepalived: T4526: keepalived-fifo.py unable to load config
keepalived-fifo.py cannot load the VyOS config because the script is started before the commit is completely finished. This change makes sure the script waits for the commit to be completed. It retries every 0.5 seconds. If the commit is still not completed it will continue as did the original implementation.
Diffstat (limited to 'src/system')
-rwxr-xr-xsrc/system/keepalived-fifo.py12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/system/keepalived-fifo.py b/src/system/keepalived-fifo.py
index a8df232ae..a0fccd1d0 100755
--- a/src/system/keepalived-fifo.py
+++ b/src/system/keepalived-fifo.py
@@ -30,6 +30,7 @@ from vyos.ifconfig.vrrp import VRRP
from vyos.configquery import ConfigTreeQuery
from vyos.util import cmd
from vyos.util import dict_search
+from vyos.util import commit_in_progress
# configure logging
logger = logging.getLogger(__name__)
@@ -63,6 +64,17 @@ class KeepalivedFifo:
# load configuration
def _config_load(self):
+ # For VRRP configuration to be read, the commit must be finished
+ count = 1
+ while commit_in_progress():
+ if ( count <= 40 ):
+ logger.debug(f'commit in progress try: {count}')
+ else:
+ logger.error(f'commit still in progress after {count} continuing anyway')
+ break
+ count += 1
+ time.sleep(0.5)
+
try:
base = ['high-availability', 'vrrp']
conf = ConfigTreeQuery()