Correctifs pour le commit précédent, et de quoi tester le chaînage.

This commit is contained in:
Pierre-Elliott Bécue 2015-03-10 20:06:18 +01:00
parent 201377528c
commit f228493399
12 changed files with 99 additions and 16 deletions

View file

@ -123,7 +123,7 @@ class EventTracker(object):
if dico == True:
return []
if isinstance(bool, dico):
if isinstance(dico, bool):
dico = {}
return [
@ -257,9 +257,10 @@ def event(ob_id, before, after, more):
#In [16]: b
#Out[16]: [('7', 3), (5, 6), ('lol', 'lal'), (3, 'lol')]
functions = list(set([function for function in itertools.chain(*[TriggerFactory.get_parser(key) for key in diff]) if function is not None]))
LOGGER.debug("[%r] in service event, functions are %r.", ob_id, functions)
# Compute the whole list of messages. This returns a list of 2-tuples. We remove None messages, which
# may occur, since there is chained-services.
# should not occcur... But, whatever.
msgs_to_send = [msg for msg in [function(ob_id, (before, after), diff) for function in functions] if msg is not None]
LOGGER.debug("[%r] in service event, messages are %r.", ob_id, msgs_to_send)
@ -278,5 +279,5 @@ def event(ob_id, before, after, more):
def trigger_send(ob_id, routing_key, body):
"""Sends a message via civet/trigger"""
body = tuple([ob_id] + [elem for elem in body])
body = tuple([ob_id] + [body])
PRODUCER.send_message("trigger.%s" % (routing_key,), body)