def _do_fire(self, event): """ Performs the actual act of firing an event to all appropriate listeners. This call will log but otherwise suppress any exception that comes out of a notifier. @param event: event object to fire @type event: pulp.server.event.data.Event """ # Determine which listeners should be notified listeners = list(EventListener.get_collection().find( {'$or': ({ 'event_types': event.event_type }, { 'event_types': '*' })})) # For each listener, retrieve the notifier and invoke it. Be sure that # an exception from a notifier is logged but does not interrupt the # remainder of the firing, nor bubble up. for l in listeners: notifier_type_id = l['notifier_type_id'] f = notifiers.get_notifier_function(notifier_type_id) try: f(l['notifier_config'], event) except Exception: _LOG.exception('Exception from notifier of type [%s]' % notifier_type_id)
def _do_fire(self, event): """ Performs the actual act of firing an event to all appropriate listeners. This call will log but otherwise suppress any exception that comes out of a notifier. @param event: event object to fire @type event: pulp.server.event.data.Event """ # Determine which listeners should be notified listeners = list( EventListener.get_collection().find({"$or": ({"event_types": event.event_type}, {"event_types": "*"})}) ) # For each listener, retrieve the notifier and invoke it. Be sure that # an exception from a notifier is logged but does not interrupt the # remainder of the firing, nor bubble up. for l in listeners: notifier_type_id = l["notifier_type_id"] f = notifiers.get_notifier_function(notifier_type_id) try: f(l["notifier_config"], event) except Exception: _logger.exception("Exception from notifier of type [%s]" % notifier_type_id)
def test_http_type_present(self): ret = notifiers.get_notifier_function(http.TYPE_ID) self.assertTrue(callable(ret)) self.assertEqual(ret, http.handle_event)