diff options
author | Daniil Baturin <daniil@vyos.io> | 2021-07-13 06:50:31 -0500 |
---|---|---|
committer | Daniil Baturin <daniil@vyos.io> | 2021-07-13 06:51:36 -0500 |
commit | f0727f83beea2f5533631d3d0e52871c4cf73d43 (patch) | |
tree | 58c256359967a0dd3a45312431d79dcbfa8a839d | |
parent | 84305a8b98bb2aa3b616324d6088b7892103ae77 (diff) | |
download | vyos-1x-f0727f83beea2f5533631d3d0e52871c4cf73d43.tar.gz vyos-1x-f0727f83beea2f5533631d3d0e52871c4cf73d43.zip |
T3663: use inotify-based watching in "show vrrp".
-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: |