def __init__(self, config, logger, parameters, number_of_queries): """ @param parameters: a dictionary with a parameter script, which should contain the name of a script, a paramater retval, which specifies the expected return value, and an optional parameter args, which specifies arguments for the script. """ ConditionPlugin.__init__(self, config, logger, parameters, number_of_queries) if not number_of_queries == 0: self.raiseException("ScriptReturnValue", "Plugin does not take any input events.") if not parameters.has_key("script"): self.raiseException("ScriptReturnValue", "Plugin needs parameter 'script'.") if not parameters.has_key("retval"): self.raiseException("ScriptReturnValue", "Plugin needs parameter 'retval'.") if not parameters["retval"].isdigit(): self.raiseException( "ScriptReturnValue", "Plugin parameter 'retval' should be an integer.") self.script = parameters['script'] self.retval = int(parameters['retval']) if parameters.has_key('args'): self.args = parameters['args'] else: self.args = ""
def __init__(self, config, logger, parameters, number_of_queries): ConditionPlugin.__init__(self, config, logger, parameters, number_of_queries) if not number_of_queries == 0: self.raiseException("Weekday", "Plugin does not take any input events.") if not parameters.has_key("days"): self.raiseException("Weekday", "Plugin needs parameter 'days'.") self.days_ok = [] for day in parameters['days'].split(','): if day == '': continue elif day.isdigit(): self.days_ok.append(int(day)) elif day.lower() in self.weekdays: self.days_ok.append(self.weekdays.index(day.lower())) else: self.raiseException("Weekday", "'%s' is not a valid weekday." % day)
def __init__(self, config, logger, parameters, number_of_queries): """ @param parameters: a dictionary with a parameter script, which should contain the name of a script, a paramater retval, which specifies the expected return value, and an optional parameter args, which specifies arguments for the script. """ ConditionPlugin.__init__(self, config, logger, parameters, number_of_queries) if not number_of_queries == 0: self.raiseException("ScriptReturnValue", "Plugin does not take any input events.") if not parameters.has_key("script"): self.raiseException("ScriptReturnValue", "Plugin needs parameter 'script'.") if not parameters.has_key("retval"): self.raiseException("ScriptReturnValue", "Plugin needs parameter 'retval'.") if not parameters["retval"].isdigit(): self.raiseException("ScriptReturnValue", "Plugin parameter 'retval' should be an integer.") self.script = parameters['script'] self.retval = int(parameters['retval']) if parameters.has_key('args'): self.args = parameters['args'] else: self.args = ""