From a1ae080499319b02a0f757125ca000c9db4c8fbb Mon Sep 17 00:00:00 2001 From: Thomas Mangin Date: Sat, 4 Apr 2020 18:54:12 +0100 Subject: openvpn: T2184: skip unactive interface Should the openvpn status file not be present, present a blank interface. --- src/op_mode/show_openvpn.py | 4 ++++ 1 file changed, 4 insertions(+) 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 . # +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): -- cgit v1.2.3