From 45fc0ec787b1c1f3ba1ac12f22c6cf69bb46122a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Javier=20S=C3=A1nchez=20Parra?= Date: Wed, 3 Aug 2022 17:30:50 +0200 Subject: [PATCH] Fetch clients from all ogServers in the dashboard With this commit, ogcp fetch all clients lists an join them. --- ogcp/views.py | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/ogcp/views.py b/ogcp/views.py index a26ad55..fe17528 100644 --- a/ogcp/views.py +++ b/ogcp/views.py @@ -117,10 +117,18 @@ def get_client_setup(ip): return db_partitions def get_clients(state_filter=None): - r = g.server.get('/clients') - clients = r.json() + responses = multi_request('get', '/clients') + + clients_list = [] + for r in responses: + clients_list = clients_list + r['json']['clients'] + + clients = {} + clients['clients'] = clients_list + if state_filter: return filter(clients.items(), lambda c: c.state == state_filter) + return clients