Ejemplo n.º 1
0
 def _validate_config_semantic_helper(self, admin, user, name, pos,
                                      deployment, kwargs):
     try:
         scenario.Scenario.validate(
             name, kwargs, admin=admin, users=[user], deployment=deployment)
     except exceptions.InvalidScenarioArgument as e:
         kw = {"name": name, "pos": pos,
               "config": kwargs, "reason": six.text_type(e)}
         raise exceptions.InvalidBenchmarkConfig(**kw)
Ejemplo n.º 2
0
 def _validate_config_sematic_helper(self, admin, user, name, pos, task,
                                     kwargs):
     args = {} if not kwargs else kwargs.get("args", {})
     try:
         base_scenario.Scenario.validate(name,
                                         args,
                                         admin=admin,
                                         users=[user],
                                         task=task)
     except exceptions.InvalidScenarioArgument as e:
         kw = {"name": name, "pos": pos, "args": args, "reason": e.message}
         raise exceptions.InvalidBenchmarkConfig(**kw)
Ejemplo n.º 3
0
 def _validate_config_syntax(self, config):
     for scenario, values in config.iteritems():
         for pos, kw in enumerate(values):
             try:
                 base_runner.ScenarioRunner.validate(kw.get("runner", {}))
                 base_ctx.ContextManager.validate(kw.get("context", {}),
                                                  non_hidden=True)
             except (exceptions.RallyException,
                     jsonschema.ValidationError) as e:
                 raise exceptions.InvalidBenchmarkConfig(name=scenario,
                                                         pos=pos,
                                                         args=kw,
                                                         reason=e.message)
Ejemplo n.º 4
0
 def _validate_config_syntax(self, config):
     for scenario, values in six.iteritems(config):
         for pos, kw in enumerate(values):
             try:
                 runner.ScenarioRunner.validate(kw.get("runner", {}))
                 context.ContextManager.validate(kw.get("context", {}),
                                                 non_hidden=True)
                 sla.SLA.validate(kw.get("sla", {}))
             except (exceptions.RallyException,
                     jsonschema.ValidationError) as e:
                 raise exceptions.InvalidBenchmarkConfig(
                     name=scenario,
                     pos=pos,
                     config=kw,
                     reason=six.text_type(e))
Ejemplo n.º 5
0
 def _validate_config_syntax(self, config):
     for subtask in config.subtasks:
         for pos, scenario_obj in enumerate(subtask.scenarios):
             try:
                 runner.ScenarioRunner.validate(
                     scenario_obj.get("runner", {}))
                 context.ContextManager.validate(
                     scenario_obj.get("context", {}), non_hidden=True)
                 sla.SLA.validate(scenario_obj.get("sla", {}))
             except (exceptions.RallyException,
                     jsonschema.ValidationError) as e:
                 raise exceptions.InvalidBenchmarkConfig(
                     name=scenario_obj["name"],
                     pos=pos, config=scenario_obj,
                     reason=six.text_type(e)
                 )
Ejemplo n.º 6
0
    def _validate_config_semantic_helper(self, admin, user, name, pos, task,
                                         kwargs):
        context = {} if not kwargs else kwargs.get("context", {})

        try:
            base_scenario.Scenario.validate(name,
                                            kwargs,
                                            admin=admin,
                                            users=[user],
                                            task=task)
            base_ctx.ContextManager.validate_semantic(context,
                                                      admin=admin,
                                                      users=[user],
                                                      task=task)
        except exceptions.InvalidScenarioArgument as e:
            kw = {
                "name": name,
                "pos": pos,
                "config": kwargs,
                "reason": six.text_type(e)
            }
            raise exceptions.InvalidBenchmarkConfig(**kw)