diff options
author | Daniil Baturin <daniil@vyos.io> | 2024-04-18 19:24:18 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-04-18 19:24:18 +0200 |
commit | 8bb55a50d08b114562bac4e4d46dc3310055c771 (patch) | |
tree | c1f2ea2be77584de0ef28c3f93a83c86bd1d31f1 /src | |
parent | 3a50e87584a89047d8a5644f1b1d7b4805ab8238 (diff) | |
parent | a43f1c00bdc5047eb20840ebb274418362612526 (diff) | |
download | vyos-1x-8bb55a50d08b114562bac4e4d46dc3310055c771.tar.gz vyos-1x-8bb55a50d08b114562bac4e4d46dc3310055c771.zip |
Merge pull request #3330 from jestabro/show-openvpn-fail
openvpn: T6245: return 'n/a' if client info not available
Diffstat (limited to 'src')
-rwxr-xr-x | src/op_mode/openvpn.py | 7 |
1 files changed, 5 insertions, 2 deletions
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' |