diff options
author | Thomas Mangin <thomas.mangin@exa.net.uk> | 2020-04-04 18:54:12 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-04-04 19:54:12 +0200 |
commit | a1ae080499319b02a0f757125ca000c9db4c8fbb (patch) | |
tree | 48137233bf7c68b9e52e177bdffccc78038aedd6 | |
parent | 6e0e210920de7984ec4e655cd679ab8c66dfebe5 (diff) | |
download | vyos-1x-a1ae080499319b02a0f757125ca000c9db4c8fbb.tar.gz vyos-1x-a1ae080499319b02a0f757125ca000c9db4c8fbb.zip |
openvpn: T2184: skip unactive interface
Should the openvpn status file not be present, present a blank
interface.
-rwxr-xr-x | src/op_mode/show_openvpn.py | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/src/op_mode/show_openvpn.py b/src/op_mode/show_openvpn.py index 06b90296f..32918ddce 100755 --- a/src/op_mode/show_openvpn.py +++ b/src/op_mode/show_openvpn.py @@ -15,6 +15,7 @@ # along with this program. If not, see <http://www.gnu.org/licenses/>. # +import os import jinja2 import argparse @@ -63,6 +64,9 @@ def get_status(mode, interface): 'clients': [], } + if not os.path.exists(status_file): + return data + with open(status_file, 'r') as f: lines = f.readlines() for line_no, line in enumerate(lines): |