DSL for tasks does not restrict content of on-success, on-error, on-complete

Bug #1714341 reported by Bob Haddleton
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Mistral
Fix Released
Medium
Vitalii Solodilov

Bug Description

The DSL for tasks does not restrict the content of the on-success, on-error, on-complete statements but defines them as types.ANY:

class DirectWorkflowTaskSpec(TaskSpec):
    _polymorphic_value = 'direct'

    _direct_workflow_schema = {
        "type": "object",
        "properties": {
            "type": {"enum": [_polymorphic_value]},
            "join": {
                "oneOf": [
                    {"enum": ["all", "one"]},
                    types.POSITIVE_INTEGER
                ]
            },
            "on-complete": types.ANY,
            "on-success": types.ANY,
            "on-error": types.ANY
        }
    }

This makes it easy to introduce bugs into the workflow which are difficult to find, for example:

on-success:
  - my_next_task '{{ _.test1 != None }}'

is valid according to the schema but it does not work the way it looks, because the Jinja condition is NOT executed and the my_next_task task is always executed, even when _.test1 is None.

After spending way too many hours trying to track down errors like this I think it would be better to specify the exact syntax that is allowed for on-success/on-error/on-complete rather than allowing anything.

The fix for this bug will define the specific types that are allowed for these branching statements.

Changed in mistral:
assignee: nobody → Bob Haddleton (bob-haddleton)
status: New → In Progress
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to mistral (master)

Fix proposed to branch: master
Review: https://review.openstack.org/499790

Changed in mistral:
importance: Undecided → Medium
milestone: none → queens-1
Changed in mistral:
milestone: queens-1 → queens-2
Changed in mistral:
milestone: queens-2 → queens-3
Changed in mistral:
milestone: queens-3 → rocky-1
Dougal Matthews (d0ugal)
Changed in mistral:
milestone: rocky-1 → rocky-2
Changed in mistral:
assignee: Bob Haddleton (bob-haddleton) → Vitalii Solodilov (mcdoker18)
Dougal Matthews (d0ugal)
Changed in mistral:
milestone: rocky-2 → rocky-3
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to mistral (master)

Reviewed: https://review.openstack.org/499790
Committed: https://git.openstack.org/cgit/openstack/mistral/commit/?id=160948e3c6f4dbc3ec9a53ff62155ffcee5ff0a6
Submitter: Zuul
Branch: master

commit 160948e3c6f4dbc3ec9a53ff62155ffcee5ff0a6
Author: Vitalii Solodilov <email address hidden>
Date: Sun May 20 14:34:44 2018 +0400

    Use on-clause and retry_policy get_spec for validation

    This patch places restrictions on the content of the on-success,
    on-complete, on-error, retry, concurrency, timeout, wait-before,
    wait-after and pause-before statements.
    test_direct_transition was refactored to exclude repeated test cases
    for on clause keys.

    Co-Authored-By: Vitalii Solodilov <email address hidden>
    Closes-Bug: #1714341
    Change-Id: I8b314c8759a46111a81cf4a9400aa1cab2ea5201
    Signed-off-by: Vitalii Solodilov <email address hidden>

Changed in mistral:
status: In Progress → Fix Released
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix included in openstack/mistral 7.0.0.0b3

This issue was fixed in the openstack/mistral 7.0.0.0b3 development milestone.

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.