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

Fix problem where only one notifier would fire when many nodes would be hooked for the information.

This commit is contained in:
jbjohnso 2014-04-23 10:59:22 -04:00
parent 02243958d2
commit e41140e24f
2 changed files with 11 additions and 4 deletions

View File

@ -857,11 +857,11 @@ class ConfigManager(object):
for node in nodeattrs.iterkeys():
if node not in attribwatchers:
continue
attribwatchers = attribwatchers[node]
attribwatcher = attribwatchers[node]
for attrname in nodeattrs[node].iterkeys():
if attrname not in attribwatchers:
if attrname not in attribwatcher:
continue
for notifierid in attribwatchers[attrname].iterkeys():
for notifierid in attribwatcher[attrname].iterkeys():
if notifierid in notifdata:
if node in notifdata[notifierid]['nodeattrs']:
notifdata[notifierid]['nodeattrs'][node].append(
@ -872,7 +872,7 @@ class ConfigManager(object):
else:
notifdata[notifierid] = {
'nodeattrs': {node: [attrname]},
'callback': attribwatchers[attrname][notifierid]
'callback': attribwatcher[attrname][notifierid]
}
for watcher in notifdata.itervalues():
callback = watcher['callback']

View File

@ -38,6 +38,7 @@ _genwatchattribs = frozenset(('console.method', 'console.logging'))
class _ConsoleHandler(object):
def __init__(self, node, configmanager):
self._isondemand = False
self.error = None
self.rcpts = {}
self.cfgmgr = configmanager
self.node = node
@ -137,6 +138,11 @@ class _ConsoleHandler(object):
self._console = plugin.handle_path(
"/nodes/%s/_console/session" % self.node,
"create", self.cfgmgr)
if not isinstance(self._console, conapi.Console):
self.connectstate = 'unconnected'
self._send_rcpts({'connectstate': self.connectstate})
self.error = 'misconfigured'
return
self.send_break = self._console.send_break
if self._attribwatcher:
self.cfgmgr.remove_watcher(self._attribwatcher)
@ -150,6 +156,7 @@ class _ConsoleHandler(object):
try:
self._console.connect(self.get_console_output)
except exc.TargetEndpointUnreachable:
self.error = 'unreachable'
self.connectstate = 'unconnected'
self._send_rcpts({'connectstate': self.connectstate})
retrytime = 30 + (30 * random.random())