diff options
author | Sander Klein <github@roedie.nl> | 2022-08-22 21:47:30 +0200 |
---|---|---|
committer | Sander Klein <github@roedie.nl> | 2022-10-30 15:44:57 +0100 |
commit | 82425099edcc48494193b00138775a8da4e70023 (patch) | |
tree | 1f3b8447ccfcc9fe64bc71ab2c458b13b39c39d6 /src/system | |
parent | ec202631ccb81a9a5ee08a97395acf19b2978bb5 (diff) | |
download | vyos-1x-82425099edcc48494193b00138775a8da4e70023.tar.gz vyos-1x-82425099edcc48494193b00138775a8da4e70023.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-x | src/system/keepalived-fifo.py | 12 |
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() |