From 58b5b2eca00acc14510dbf2c741f12d7e799a264 Mon Sep 17 00:00:00 2001 From: Javier Hernandez Date: Wed, 10 Jan 2024 10:00:14 +0100 Subject: views: Warn user when no logs available Warn user if trying to access the logs of a client that don't yet exist. This is prefered to showing the backtrace to the user. --- ogcp/views.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/ogcp/views.py b/ogcp/views.py index b83abb4..b124287 100644 --- a/ogcp/views.py +++ b/ogcp/views.py @@ -2100,6 +2100,9 @@ def action_legacy_log(): return redirect(url_for('commands')) ip = ips.pop() log_file = Path("/opt/opengnsys/log/clients/" + str(ip) + ".log") + if not os.access(log_file, os.R_OK): + flash(_('No log available for this client yet'), category='error') + return redirect(url_for('commands')) log = log_file.read_text() if log: scopes, clients = get_scopes(set(ips)) -- cgit v1.2.3-18-g5258