summaryrefslogtreecommitdiff
path: root/python
diff options
context:
space:
mode:
authorDaniil Baturin <daniil@vyos.io>2021-07-13 06:50:31 -0500
committerDaniil Baturin <daniil@vyos.io>2021-07-13 07:14:34 -0500
commit5c52cbc18a73097b79383e0930644b36449e4b7a (patch)
tree0bc2fd622444250a4007dc461e9ab0f2b8dce92d /python
parent68d14c69805972e1c76a98dd745360c3456d5c68 (diff)
downloadvyos-1x-5c52cbc18a73097b79383e0930644b36449e4b7a.tar.gz
vyos-1x-5c52cbc18a73097b79383e0930644b36449e4b7a.zip
T3663: use inotify-based watching in "show vrrp".
Diffstat (limited to 'python')
-rw-r--r--python/vyos/ifconfig/vrrp.py9
1 files changed, 6 insertions, 3 deletions
diff --git a/python/vyos/ifconfig/vrrp.py b/python/vyos/ifconfig/vrrp.py
index d3e9d5df2..b522cc1ab 100644
--- a/python/vyos/ifconfig/vrrp.py
+++ b/python/vyos/ifconfig/vrrp.py
@@ -92,11 +92,14 @@ class VRRP(object):
try:
# 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(fname,
+ 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: