From 3976eebd3d107c14e22426ff2cdb66dc31e9be20 Mon Sep 17 00:00:00 2001 From: John Estabrook Date: Thu, 18 Apr 2024 08:33:54 -0500 Subject: openvpn: T6245: return 'n/a' if client info not available (cherry picked from commit a43f1c00bdc5047eb20840ebb274418362612526) --- src/op_mode/openvpn.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/op_mode/openvpn.py b/src/op_mode/openvpn.py index d54a67199..092873909 100755 --- a/src/op_mode/openvpn.py +++ b/src/op_mode/openvpn.py @@ -48,9 +48,12 @@ def _get_tunnel_address(peer_host, peer_port, status_file): # 10.10.2.0/25,client1,... lst = [l for l in lst[1:] if '/' not in l.split(',')[0]] - tunnel_ip = lst[0].split(',')[0] + if lst: + tunnel_ip = lst[0].split(',')[0] - return tunnel_ip + return tunnel_ip + + return 'n/a' def _get_interface_status(mode: str, interface: str) -> dict: status_file = f'/run/openvpn/{interface}.status' -- cgit v1.2.3