From 54d93571d1b9a00fc2479944b1b0f145cbb2c288 Mon Sep 17 00:00:00 2001 From: Jarrod Johnson Date: Thu, 19 Jul 2018 16:26:05 -0400 Subject: [PATCH] Have leader provide more data in collective show --- confluent_server/confluent/collective/manager.py | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/confluent_server/confluent/collective/manager.py b/confluent_server/confluent/collective/manager.py index c6723d84..fd1b6f36 100644 --- a/confluent_server/confluent/collective/manager.py +++ b/confluent_server/confluent/collective/manager.py @@ -191,12 +191,21 @@ def handle_connection(connection, cert, request, local=False): {'collective': {'error': 'Collective does not have quorum'}}) return + collinfo = {} if follower: - myleader = cfm.get_collective_member_by_address( + collinfo['leader'] = cfm.get_collective_member_by_address( currentleader)['name'] else: - myleader = get_myname() - tlvdata.send(connection, {'collective': {'leader': myleader}}) + iam = get_myname() + collinfo['leader'] = iam + collinfo['active'] = list(cfm.cfgstreams) + activemembers = set(cfm.cfgstreams) + activemembers.add(iam) + collinfo['offline'] = [] + for member in cfm.list_collective(): + if member not in activemembers: + collinfo['offline'].append(member) + tlvdata.send(connection, {'collective': collinfo}) return if 'invite' == operation: try: