From d2dba589dddc2c5500010cee5e17a1d8b8530122 Mon Sep 17 00:00:00 2001 From: Dawid Deja Date: Mon, 11 Jul 2016 17:31:07 +0200 Subject: [PATCH] Add param 'safe-rerun' to task Partially implements blueprint mistral-task-delivery-model Change-Id: Ibf1ea11295177db029ebcfd7e46f791a8b6d9e67 --- mistral/workbook/v2/tasks.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/mistral/workbook/v2/tasks.py b/mistral/workbook/v2/tasks.py index e7dd0729..a2a77906 100644 --- a/mistral/workbook/v2/tasks.py +++ b/mistral/workbook/v2/tasks.py @@ -62,7 +62,8 @@ class TaskSpec(base.BaseSpec): "pause-before": policies.PAUSE_BEFORE_SCHEMA, "concurrency": policies.CONCURRENCY_SCHEMA, "target": types.NONEMPTY_STRING, - "keep-result": types.YAQL_OR_BOOLEAN + "keep-result": types.YAQL_OR_BOOLEAN, + "safe-rerun": types.YAQL_OR_BOOLEAN }, "additionalProperties": False, "anyOf": [ @@ -108,6 +109,7 @@ class TaskSpec(base.BaseSpec): ) self._target = data.get('target') self._keep_result = data.get('keep-result', True) + self._safe_rerun = data.get('safe-rerun', False) self._process_action_and_workflow() @@ -125,6 +127,7 @@ class TaskSpec(base.BaseSpec): self.validate_yaql_expr(self._data.get('input', {})) self.validate_yaql_expr(self._data.get('publish', {})) self.validate_yaql_expr(self._data.get('keep-result', {})) + self.validate_yaql_expr(self._data.get('safe-rerun', {})) def _transform_with_items(self): raw = self._data.get('with-items', []) @@ -210,6 +213,9 @@ class TaskSpec(base.BaseSpec): def get_keep_result(self): return self._keep_result + def get_safe_rerun(self): + return self._safe_rerun + class DirectWorkflowTaskSpec(TaskSpec): _polymorphic_value = 'direct'