2
0
mirror of https://github.com/xcat2/confluent.git synced 2024-11-22 17:43:14 +00:00

Add check for quorum to invite generation process

If a would-be collective member has no quorum, provide a clear
message indicating this as an issue.
This commit is contained in:
Jarrod Johnson 2018-06-26 14:55:42 -04:00
parent 401352998c
commit 68a79695fc

View File

@ -17,6 +17,7 @@
import base64
import confluent.collective.invites as invites
import confluent.config.configmanager as cfm
import confluent.exceptions as exc
import confluent.tlvdata as tlvdata
import confluent.util as util
import eventlet
@ -140,6 +141,13 @@ def handle_connection(connection, cert, request, local=False):
{'error': 'Invite can only be run from current '
'leader ({0})'.format(currentleader)}})
return
try:
cfm.check_quorum()
except exc.DegradedCollective:
tlvdata.send(connection,
{'collective':
{'error': 'Collective does not have quorum'})
return
#TODO(jjohnson2): Cannot do the invitation if not the head node, the certificate hand-carrying
#can't work in such a case.
name = request['name']