summaryrefslogtreecommitdiffstats
path: root/ogcp/views.py
diff options
context:
space:
mode:
authorAlejandro Sirgo Rica <asirgo@soleta.eu>2024-10-10 11:48:29 +0200
committerAlejandro Sirgo Rica <asirgo@soleta.eu>2024-10-10 11:48:29 +0200
commitbcffdff1358ce4d7a7d26e84f19aca29f27687df (patch)
treea46c2dc8339cacc12b80406413dbf481c3166ed7 /ogcp/views.py
parent75cd6d98833075cd9aeaddd5f5a95b870ff246ac (diff)
views.py: prevent backtrace with unregistered client
Add check to skip unregistered clients in get_server_data_from_scopes to prevent KeyError exception.
Diffstat (limited to 'ogcp/views.py')
-rw-r--r--ogcp/views.py3
1 files changed, 3 insertions, 0 deletions
diff --git a/ogcp/views.py b/ogcp/views.py
index 899a3a9..8a7463a 100644
--- a/ogcp/views.py
+++ b/ogcp/views.py
@@ -608,6 +608,9 @@ def get_server_data_from_scopes(scopes, clients):
ip_to_name = {ip: c['name'] for c in parse_scopes_from_tree(scopes, 'computer') for ip in c['ip']}
for client in clients['clients']:
+ if not client['addr'] in ip_to_name:
+ continue
+
client['name'] = ip_to_name[client['addr']]
server_id = client['server'].id
if server_id not in servers_data: