diff --git a/mistral/tests/unit/workbook/v2/test_dsl_specs_v2.py b/mistral/tests/unit/workbook/v2/test_dsl_specs_v2.py index 03032a0d2..dd4f47b06 100644 --- a/mistral/tests/unit/workbook/v2/test_dsl_specs_v2.py +++ b/mistral/tests/unit/workbook/v2/test_dsl_specs_v2.py @@ -105,7 +105,7 @@ workflows: task7: with-items: vm_info in $.vms - workflow: wf2 is_true=true object_list=[1, null, "str"] + workflow: wf2 is_true=true object_list=[1, null, "str"] is_string="50" on-complete: - task9 - task10 @@ -327,6 +327,7 @@ class DSLv2ModelTest(base.BaseTest): { 'is_true': True, 'object_list': [1, None, 'str'], + 'is_string': '50' }, task7_spec.get_input() ) diff --git a/mistral/workbook/base.py b/mistral/workbook/base.py index d97a86543..a56a3aec3 100644 --- a/mistral/workbook/base.py +++ b/mistral/workbook/base.py @@ -21,8 +21,22 @@ from mistral import exceptions as exc CMD_PTRN = re.compile("^[\w\.]+[^=\s\"]*") -PARAMS_PTRN = re.compile("([\w]+)=(\"[^\"]*\"\s*|'[^']*'\s*|" - "\{[^}]*\}\s*|\[.*\]\s*|[\.,:\w\d\.]+)") + +_ALL_IN_BRACES = "\{[^}]*\}\s*" +_ALL_IN_BRACKETS = "\[.*\]\s*" +_ALL_IN_QUOTES = "\"[^\"]*\"\s*" +_ALL_IN_APOSTROPHES = "'[^']*'\s*" +_DIGITS = "\d+" +_TRUE = "true" +_FALSE = "false" +_NULL = "null" + +ALL = ( + _ALL_IN_QUOTES, _ALL_IN_APOSTROPHES, _ALL_IN_BRACES, + _ALL_IN_BRACKETS, _TRUE, _FALSE, _NULL, _DIGITS +) + +PARAMS_PTRN = re.compile("([\w]+)=(%s)" % "|".join(ALL)) class BaseSpec(object):