It is impossible to create a workflow with "version" in the name

Bug #1645354 reported by Dougal Matthews
12
This bug affects 2 people
Affects Status Importance Assigned to Milestone
Mistral
Fix Released
Medium
Dougal Matthews

Bug Description

There is some bad validation going on that causes an error if your workflow has "version" in the name. Here it an example:

    [stack@instack ~]$ cat wf.yaml
    ---
        version: '2.0'
    name: testing

    workflows:
      workflow_name_containing_version:
        tasks:
          poll_versions:
            action: std.noop

    [stack@instack ~]$ mistral workbook-create wf.yaml
    ERROR (app) Invalid DSL: {'tasks': {'poll_versions': {'action':
    'std.noop'}}} is not one of ['2.0', 2.0]

    Failed validating 'enum' in schema['properties']['workflows']
    ['patternProperties']['version']: {'enum': ['2.0', 2.0]}

    On instance['workflows']['workflow_name_containing_version']:
        {'tasks': {'poll_versions': {'action': 'std.noop'}}}

Dougal Matthews (d0ugal)
description: updated
Revision history for this message
Dougal Matthews (d0ugal) wrote :

It turns out you can create a workflow with "version" in the name, but you can't create a workbook with a workflow with version in the name. So this bug is specific to workbook validation.

Revision history for this message
Dougal Matthews (d0ugal) wrote :

We also need to document that "version" is a reserved key and can't be used as a workflow, workbook or action name.

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/405253

Changed in mistral:
status: Confirmed → In Progress
Changed in mistral:
milestone: none → ocata-2
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to mistral (master)

Reviewed: https://review.openstack.org/405253
Committed: https://git.openstack.org/cgit/openstack/mistral/commit/?id=ba67b3aff8bdcf1ce951d1f61e69ba19799a09fc
Submitter: Jenkins
Branch: master

commit ba67b3aff8bdcf1ce951d1f61e69ba19799a09fc
Author: Dougal Matthews <email address hidden>
Date: Wed Nov 30 08:01:34 2016 +0000

    Allow "version" to be within workflow names in workbooks

    There were two bugs in the schema validation for Mistral workflow names
    within Workbooks. The goal in this part of the validation is to detect the
    version property and assign it the enum type and then assin all other
    single word properties to use the workflow/action schemas.

    1. Detecting version properties. The code before this patch has the
    following line.

        "version": {"enum": ["2.0", 2.0]},

    This looked safe, but "version" is actually a regular expression.
    Meaning that it will match any string containging "version". Adding ^ at the
    start and $ at the end means that it matches a string from the start to the
    end and is exactly "version".

    2. Detecting workflows/actions. The current regular expression was

        "^(?!version)\w+$": _action_schema

    This worked in most cases. It basically means "Any word that doesn't
    start with version". So this worked, but was incorrect for workflows
    called "versionworkflow" - it didn't match this when it should have.
    Using ?: to create a non-capturing portion of the regular expression
    solved this issue.

    Any workflows that have a name that doesn't match this regular
    expression. Such as those with a space (like "my worflow") were silently
    ignored before this patch. The addition of additionalProperties: False
    in the schema shows users an error if they use an invalid workflow name.

    Closes-Bug: #1645354
    Change-Id: Ib2b406a05cf15b41be075f886de77509a9da8535

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

This issue was fixed in the openstack/mistral 4.0.0.0b2 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.