Beispiel #1
0
def condition_plugin(config, logger, name, parameters, queries):
	"""
	Returns a function, which executes the specified condition plugin, when it
	is called.
	"""
	plugin = condition_plugins.get_plugin(name)
	plugin_instance = plugin(config, logger, parameters, len(queries))
	def condition_plugin_generated(**kwargs):
		""" Dynamically generated function. """
		events = []
		for query in queries:
			events.append(query(**kwargs))
		# note: events should not be changed. for safety, we could pass a copy;
		# that would cost more resources however
		return plugin_instance.checkCondition(kwargs['trigger'], events)
	return condition_plugin_generated
Beispiel #2
0
def condition_plugin(config, logger, name, parameters, queries):
    """
	Returns a function, which executes the specified condition plugin, when it
	is called.
	"""
    plugin = condition_plugins.get_plugin(name)
    plugin_instance = plugin(config, logger, parameters, len(queries))

    def condition_plugin_generated(**kwargs):
        """ Dynamically generated function. """
        events = []
        for query in queries:
            events.append(query(**kwargs))
        # note: events should not be changed. for safety, we could pass a copy;
        # that would cost more resources however
        return plugin_instance.checkCondition(kwargs['trigger'], events)

    return condition_plugin_generated
Beispiel #3
0
	def setUp(self):
		self.Weekday = condition_plugins.get_plugin('weekday')
Beispiel #4
0
	def setUp(self):
		self.script_plugin = condition_plugins.get_plugin("script_return_value")