From 1ee418392f1c45dcce2130c82ba5188e370d1647 Mon Sep 17 00:00:00 2001 From: Jarrod Johnson Date: Tue, 9 Oct 2018 15:44:17 -0400 Subject: [PATCH] Provide better error behavior on missing collective.manager collective.manager was a blanket response, make it per node and only triggered by the bad nodes, not the rest. --- confluent_server/confluent/core.py | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/confluent_server/confluent/core.py b/confluent_server/confluent/core.py index cc469661..cdbfa359 100644 --- a/confluent_server/confluent/core.py +++ b/confluent_server/confluent/core.py @@ -585,6 +585,15 @@ class BadPlugin(object): self.node, self.plugin + ' is not a supported plugin') +class BadCollective(object): + def __init__(self, node): + self.node = node + + def error(self, *args, **kwargs): + yield msg.ConfluentNodeError( + self.node, 'collective mode is active, but collective.manager ' + 'is not set for this node') + def abbreviate_noderange(configmanager, inputdata, operation): if operation != 'create': raise exc.InvalidArgumentException('Must be a create with nodes in list') @@ -777,6 +786,7 @@ def handle_node_request(configmanager, inputdata, operation, continue elif list(cfm.list_collective()): badcollnodes.append(node) + continue if plugpath is not None: try: hfunc = getattr(pluginmap[plugpath], operation) @@ -787,11 +797,8 @@ def handle_node_request(configmanager, inputdata, operation, nodesbyhandler[hfunc].append(node) else: nodesbyhandler[hfunc] = [node] - if badcollnodes: - raise exc.ConfluentException( - 'collective management active, ' - 'collective.manager must be set for {0}'.format( - ','.join(badcollnodes))) + for bn in badcollnodes: + nodesbyhandler[BadCollective(bn).error] = [bn] workers = greenpool.GreenPool() numworkers = 0 for hfunc in nodesbyhandler: