From a39f8c73ba6063c01e734b27a6e6a6dc72b20a2d Mon Sep 17 00:00:00 2001 From: sarthurdev <965089+sarthurdev@users.noreply.github.com> Date: Thu, 28 Mar 2024 21:04:47 +0100 Subject: dhcp: T6174: Add TACACS/Radius users to _kea group Also raise op-mode error when unable to fetch data from Kea socket --- src/op_mode/dhcp.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'src/op_mode') diff --git a/src/op_mode/dhcp.py b/src/op_mode/dhcp.py index a2f947400..f6029c748 100755 --- a/src/op_mode/dhcp.py +++ b/src/op_mode/dhcp.py @@ -80,14 +80,20 @@ def _get_raw_server_leases(family='inet', pool=None, sorted=None, state=[], orig :return list """ inet_suffix = '6' if family == 'inet6' else '4' - leases = kea_get_leases(inet_suffix) + try: + leases = kea_get_leases(inet_suffix) + except: + raise vyos.opmode.DataUnavailable('Cannot fetch DHCP server lease information') if pool is None: pool = _get_dhcp_pools(family=family) else: pool = [pool] - active_config = kea_get_active_config(inet_suffix) + try: + active_config = kea_get_active_config(inet_suffix) + except: + raise vyos.opmode.DataUnavailable('Cannot fetch DHCP server configuration') data = [] for lease in leases: -- cgit v1.2.3