2
0
mirror of https://github.com/xcat2/confluent.git synced 2024-11-22 09:32:21 +00:00

Correctly show the error on non-leader

When non-leader tries to invite, print the error rather than unhelpful
exception with no helpful data.
This commit is contained in:
Jarrod Johnson 2018-06-26 14:35:23 -04:00
parent 9eeede651e
commit 401352998c

View File

@ -41,8 +41,11 @@ def show_invitation(name):
make_certificate()
s = client.Command().connection
tlvdata.send(s, {'collective': {'operation': 'invite', 'name': name}})
invite = tlvdata.recv(s)['collective']['invitation']
print ('Invitatation for {0}: {1}'.format(name, invite))
invite = tlvdata.recv(s)['collective']
if 'error' in invite:
sys.stderr.write(invite['error'] + '\n')
return
print ('Invitatation for {0}: {1}'.format(name, invite['invitation']))
def join_collective(server, invitation):