def validate_trigger_parameters(trigger_type_ref, parameters):
 if (not trigger_type_ref):
  return None
 is_system_trigger = (trigger_type_ref in SYSTEM_TRIGGER_TYPES)
 if is_system_trigger:
  parameters_schema = SYSTEM_TRIGGER_TYPES[trigger_type_ref]['parameters_schema']
 else:
  trigger_type_db = triggers.get_trigger_type_db(trigger_type_ref)
  if (not trigger_type_db):
   return None
  parameters_schema = getattr(trigger_type_db, 'parameters_schema', {})
  if (not parameters_schema):
   return None
 if ((not is_system_trigger) and (not cfg.CONF.system.validate_trigger_parameters)):
  LOG.debug(('Got non-system trigger "%s", but trigger parameter validation for non-systemtriggers is disabled, skipping validation.' % trigger_type_ref))
  return None
 cleaned = util_schema.validate(instance=parameters, schema=parameters_schema, cls=util_schema.CustomValidator, use_default=True, allow_default_none=True)
 if (trigger_type_ref == CRON_TIMER_TRIGGER_REF):
  CronTrigger(**parameters)
 return cleaned

def validate_trigger_parameters ( trigger_type_ref , parameters ) : if ( not trigger_type_ref ) : return None is_system_trigger = ( trigger_type_ref in SYSTEM_TRIGGER_TYPES ) if is_system_trigger : parameters_schema = SYSTEM_TRIGGER_TYPES [ trigger_type_ref ] [ 'parameters_schema' ] else : trigger_type_db = triggers . get_trigger_type_db ( trigger_type_ref ) if ( not trigger_type_db ) : return None parameters_schema = getattr ( trigger_type_db , 'parameters_schema' , { } ) if ( not parameters_schema ) : return None if ( ( not is_system_trigger ) and ( not cfg . CONF . system . validate_trigger_parameters ) ) : LOG . debug ( ( 'Got non-system trigger "%s", but trigger parameter validation for non-systemtriggers is disabled, skipping validation.' % trigger_type_ref ) ) return None cleaned = util_schema . validate ( instance = parameters , schema = parameters_schema , cls = util_schema . CustomValidator , use_default = True , allow_default_none = True ) if ( trigger_type_ref == CRON_TIMER_TRIGGER_REF ) : CronTrigger ( ** parameters ) return cleaned
this function validates parameters for system and user-defined triggers .