diff options
-rw-r--r-- | python/vyos/ifconfig/vrrp.py | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/python/vyos/ifconfig/vrrp.py b/python/vyos/ifconfig/vrrp.py index d3e9d5df2..4259060a2 100644 --- a/python/vyos/ifconfig/vrrp.py +++ b/python/vyos/ifconfig/vrrp.py @@ -93,10 +93,14 @@ class VRRP(object): # send signal to generate the configuration file pid = util.read_file(cls.location['pid']) os.kill(int(pid), cls._signal[what]) + util.wait_for_file_write_complete(vyos.keepalived.json_file, + pre_hook=(lambda: os.kill(int(pid), cls._signal[what])), + timeout=30) - # should look for file size change? - sleep(0.2) return util.read_file(fname) + except OSError: + # raised by vyos.util.read_file + raise VRRPNoData("VRRP data is not available (wait time exceeded)") except FileNotFoundError: raise VRRPNoData("VRRP data is not available (process not running or no active groups)") except Exception: |