summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniil Baturin <daniil@vyos.io>2024-03-29 02:15:24 +0100
committerGitHub <noreply@github.com>2024-03-29 02:15:24 +0100
commit5e72a71a9bbbef76bda47e34e911ac1fcc015b01 (patch)
treeeb07c4979619836f22036a786d48f03adc7b623c
parentcdd866394d388f37f3fb2f4956508a72f403a27c (diff)
parent505eadc41643b5b426a4c4fd4068de82551e6fe2 (diff)
downloadvyos-1x-5e72a71a9bbbef76bda47e34e911ac1fcc015b01.tar.gz
vyos-1x-5e72a71a9bbbef76bda47e34e911ac1fcc015b01.zip
Merge pull request #3209 from vyos/mergify/bp/sagitta/pr-3198
openvpn: T6159: Openvpn Server Op-cmd adds heading "OpenVPN status on vtunx" for every client connection (backport #3198)
-rwxr-xr-xsrc/op_mode/openvpn.py7
1 files changed, 3 insertions, 4 deletions
diff --git a/src/op_mode/openvpn.py b/src/op_mode/openvpn.py
index fd9d2db92..d54a67199 100755
--- a/src/op_mode/openvpn.py
+++ b/src/op_mode/openvpn.py
@@ -205,11 +205,11 @@ def _format_openvpn(data: list) -> str:
intf = d['intf']
l_host = d['local_host']
l_port = d['local_port']
+ out += f'\nOpenVPN status on {intf}\n\n'
for client in d['clients']:
r_host = client['remote_host']
r_port = client['remote_port']
- out += f'\nOpenVPN status on {intf}\n\n'
name = client['name']
remote = r_host + ':' + r_port if r_host and r_port else 'N/A'
tunnel = client['tunnel']
@@ -220,9 +220,8 @@ def _format_openvpn(data: list) -> str:
data_out.append([name, remote, tunnel, local, tx_bytes,
rx_bytes, online_since])
- if data_out:
- out += tabulate(data_out, headers)
- out += "\n"
+ out += tabulate(data_out, headers)
+ out += "\n"
return out