Fetch clients from all ogServers in the dashboard

With this commit, ogcp fetch all clients lists an join them.
async-tree
Javier Sánchez Parra 2022-08-03 17:30:50 +02:00
parent af0a3255b4
commit 279184df5f
1 changed files with 10 additions and 2 deletions

View File

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