From bcff3fc962c0812e18d4d2e7de05a2a9006657f8 Mon Sep 17 00:00:00 2001 From: Jarrod Johnson Date: Thu, 19 Jul 2018 16:39:13 -0400 Subject: [PATCH] Improve collective show readability --- confluent_server/bin/collective | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/confluent_server/bin/collective b/confluent_server/bin/collective index 34d6accc..cfb5f305 100644 --- a/confluent_server/bin/collective +++ b/confluent_server/bin/collective @@ -74,7 +74,21 @@ def show_collective(): s = client.Command().connection tlvdata.send(s, {'collective': {'operation': 'show'}}) res = tlvdata.recv(s) - print(repr(res)) + if 'error' in res['collective']: + print(res['error']['collective']) + return + print('Leader: {0}'.format(res['collective']['leader'])) + if 'active' in res['collective']: + if res['collective']['active']: + print('Active collective members:') + for member in res['collective']['active']: + print(' {0}'.format(member)) + if res['collective']['offline']: + print('Offline collective members:') + for member in res['collective']['offline']: + print(' {0}'.format(member)) + else: + print('Run collective show on leader for more data') def main(): a = argparse.ArgumentParser(description='Confluent server utility')