2
0
mirror of https://github.com/xcat2/confluent.git synced 2025-01-13 11:17:49 +00:00

Short out operations if in collective mode but no collective.manager

This commit is contained in:
Jarrod Johnson 2018-07-17 15:25:12 -04:00
parent ddd7ef5eba
commit cf9ad11290
3 changed files with 15 additions and 0 deletions

View File

@ -236,6 +236,10 @@ class ConsoleHandler(object):
def check_collective(self, attrvalue):
myc = attrvalue.get(self.node, {}).get('collective.manager', {}).get(
'value', None)
if configmodule.list_collective() and not myc:
self._is_local = False
self._detach()
self._disconnect()
if myc and myc != collective.get_myname():
# Do not do console connect for nodes managed by another
# confluent collective member

View File

@ -739,6 +739,7 @@ def handle_node_request(configmanager, inputdata, operation,
plugpath = None
nodesbymanager = {}
nodesbyhandler = {}
badcollnodes = []
for node in nodes:
for attrname in plugroute['pluginattrs']:
if attrname in nodeattr[node]:
@ -756,6 +757,8 @@ def handle_node_request(configmanager, inputdata, operation,
else:
nodesbymanager[manager].add(node)
continue
elif cfm.list_collective():
badcollnodes.append(node)
if plugpath is not None:
try:
hfunc = getattr(pluginmap[plugpath], operation)
@ -766,6 +769,11 @@ 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 by set for {0}'.format(
','.join(badcollnodes)))
workers = greenpool.GreenPool()
numworkers = 0
for hfunc in nodesbyhandler:

View File

@ -30,6 +30,9 @@ class _ShellHandler(consoleserver.ConsoleHandler):
_genwatchattribs = False
_logtobuffer = False
def check_collective(self, attrvalue):
return
def log(self, *args, **kwargs):
# suppress logging through proving a stub 'log' function
return