From 68a79695fc2c6af101fb694172bedf07ffd2bbe6 Mon Sep 17 00:00:00 2001 From: Jarrod Johnson Date: Tue, 26 Jun 2018 14:55:42 -0400 Subject: [PATCH] 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. --- confluent_server/confluent/collective/manager.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/confluent_server/confluent/collective/manager.py b/confluent_server/confluent/collective/manager.py index e457da4d..7539fcc0 100644 --- a/confluent_server/confluent/collective/manager.py +++ b/confluent_server/confluent/collective/manager.py @@ -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']