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.
master
Javier Hernandez 2024-01-10 10:00:14 +01:00 committed by OpenGnSys Support Team
parent 58852f68aa
commit 58b5b2eca0
1 changed files with 3 additions and 0 deletions

View File

@ -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))