Mistral Workflows should validate their inputs

Bug #1774166 reported by Dougal Matthews
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
tripleo
Won't Fix
Medium
Unassigned

Bug Description

Many of the workflows accept inputs, but if they are changed from the defaults and don't match what is expected they can fail in obscure ways.

We could work around this with a custom action that validates inputs. It would then be used at the start of workflows to validate the inputs as the first task. It could look something like this...

tasks:
  validate_inputs:
    action: tripleo.validate_inputs
    input:
      task_context: <% $ %>
      types:
        queue_name: string
        container: plan_name
        timeout: integer
    on-success: original_workflow_first_action

This would verify that the queue_name, container and timeout inputs. The "types" (string, plan_name and integer) would need to be known names in the action which would map to a validating function/regex.

The action could look something like this...

validators = {
    "plan_name": validating_function,
    ...
}

class ValidateInputs(base.Action):
    def __input__(self, task_context, types):
        self.task_context = task_context
        self.types = types
    def run(self, context):

        for name, type in self.types.items():
            value = self.task_context.get(name)
            assert validators[type](value)

Tags: workflows
Changed in tripleo:
status: Confirmed → Triaged
milestone: none → rocky-2
Changed in tripleo:
milestone: rocky-2 → rocky-3
Changed in tripleo:
milestone: rocky-3 → rocky-rc1
Changed in tripleo:
milestone: rocky-rc1 → stein-1
Revision history for this message
Dougal Matthews (d0ugal) wrote :

I think it makes more sense to try and solve this more generally in Mistral.

Changed in tripleo:
status: Triaged → Won't Fix
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.