Browse Source

Fix detection of 'wg show interface' not running

When main.py initializes the subprocess returns an output of 'No such
device' but it doesn't throw any exception, for some reason...?

So, the output was of course returned to the is_running process and
since it wasn't "None" it though the interface was in the 'running'
state.
pull/15/head
Simon Lerpard 4 years ago
parent
commit
665167aa3f
  1. 2
      wg_dashboard_backend/script/wireguard.py

2
wg_dashboard_backend/script/wireguard.py

@ -108,7 +108,7 @@ def restart_interface(server: schemas.WGServer):
def is_running(server: schemas.WGServer):
try:
output = _run_wg(server, ["show", server.interface])
if output is None:
if output is None or b'Unable to access interface: No such device' in output:
return False
except Exception as e:
if b'No such device' in e.output:

Loading…
Cancel
Save