From 9fc8158f98ba7154da9867d9a28f00e39f76d0e0 Mon Sep 17 00:00:00 2001 From: Daniil Baturin Date: Thu, 25 Jun 2020 09:22:46 +0300 Subject: T2487: add an exception for the case when VRRP stats aren't available. --- python/vyos/ifconfig/vrrp.py | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'python') diff --git a/python/vyos/ifconfig/vrrp.py b/python/vyos/ifconfig/vrrp.py index a872725b2..5e6387881 100644 --- a/python/vyos/ifconfig/vrrp.py +++ b/python/vyos/ifconfig/vrrp.py @@ -28,6 +28,9 @@ from vyos import util class VRRPError(Exception): pass +class VRRPNoData(VRRPError): + pass + class VRRP(object): _vrrp_prefix = '00:00:5E:00:01:' location = { @@ -96,6 +99,8 @@ class VRRP(object): # shoud look for file size change ? sleep(0.2) return util.read_file(fname) + except FileNotFoundError: + raise VRRPNoData("VRRP data is not available (process not running or no active groups)") except Exception: name = cls._name[what] raise VRRPError(f'VRRP {name} is not available') -- cgit v1.2.3