From b8d94ee4b832f52008d80d72b4b15bd804e738f0 Mon Sep 17 00:00:00 2001 From: Dougal Matthews Date: Fri, 20 Jan 2017 14:18:45 +0000 Subject: [PATCH] Allow hyphens in Workflow and ad-hoc action names In ba67b3aff8bdcf1ce951d1f61e69ba19799a09fc validation of Workflow and Action names was fixed. This had the unintended side effect of making the validation much stricter. This change adds hyphens to the allows characters. Change-Id: Ib05c4988ea3dbeaf5f29f5f5674a606b3c652f2d --- .../resources/workbook/v2/workbook_schema_test.yaml | 9 +++++++++ mistral/tests/unit/workbook/v2/test_workbook.py | 1 + mistral/workbook/v2/workbook.py | 2 +- 3 files changed, 11 insertions(+), 1 deletion(-) diff --git a/mistral/tests/resources/workbook/v2/workbook_schema_test.yaml b/mistral/tests/resources/workbook/v2/workbook_schema_test.yaml index 1e397324..dd6ac32b 100644 --- a/mistral/tests/resources/workbook/v2/workbook_schema_test.yaml +++ b/mistral/tests/resources/workbook/v2/workbook_schema_test.yaml @@ -16,6 +16,9 @@ actions: actionversionaction: base: std.noop + action-action: + base: std.noop + workflows: workflowversion: @@ -41,3 +44,9 @@ workflows: tasks: task1: workflow: workflowversion + + workflow-with-hyphen: + description: Workflow name containing - + tasks: + task1: + action: action-action diff --git a/mistral/tests/unit/workbook/v2/test_workbook.py b/mistral/tests/unit/workbook/v2/test_workbook.py index a53eea74..62019eb5 100644 --- a/mistral/tests/unit/workbook/v2/test_workbook.py +++ b/mistral/tests/unit/workbook/v2/test_workbook.py @@ -412,6 +412,7 @@ class WorkbookSpecValidation(base.WorkbookSpecValidationTestCase): "versionworkflow", "workflowversionworkflow", "version_workflow", + "version-workflow", ) for valid in valid_names: diff --git a/mistral/workbook/v2/workbook.py b/mistral/workbook/v2/workbook.py index 84c5f639..2f5d963f 100644 --- a/mistral/workbook/v2/workbook.py +++ b/mistral/workbook/v2/workbook.py @@ -18,7 +18,7 @@ from mistral.workbook.v2 import base from mistral.workbook.v2 import workflows as wf # We want to match any single word that isn't exactly "version" -NON_VERSION_WORD_REGEX = "^(?!version$)\w+$" +NON_VERSION_WORD_REGEX = "^(?!version$)[\w-]+$" class WorkbookSpec(base.BaseSpec):