From 395813e7b8fead0878a9a9ea7295d7148985d842 Mon Sep 17 00:00:00 2001 From: Renat Akhmerov Date: Wed, 17 Sep 2014 13:13:59 -0700 Subject: [PATCH] Fixing task/workflow specs to do transformations with 'on-XXX' once Change-Id: Id7617070d1b413af30b073e30b7e23285609e541 --- mistral/workbook/v2/tasks.py | 9 ++++++--- mistral/workbook/v2/workflows.py | 9 ++++++--- 2 files changed, 12 insertions(+), 6 deletions(-) diff --git a/mistral/workbook/v2/tasks.py b/mistral/workbook/v2/tasks.py index 47a59b24..741be86c 100644 --- a/mistral/workbook/v2/tasks.py +++ b/mistral/workbook/v2/tasks.py @@ -60,6 +60,9 @@ class TaskSpec(base.BaseSpec): task_policies.TaskPoliciesSpec ) self._requires = data.get('requires', []) + self._on_complete = self._as_list_of_tuples('on-complete') + self._on_success = self._as_list_of_tuples('on-success') + self._on_error = self._as_list_of_tuples('on-error') self._process_action_and_workflow() @@ -112,13 +115,13 @@ class TaskSpec(base.BaseSpec): return self._requires def get_on_complete(self): - return self._as_list_of_tuples('on-complete') + return self._on_complete def get_on_success(self): - return self._as_list_of_tuples('on-success') + return self._on_success def get_on_error(self): - return self._as_list_of_tuples('on-error') + return self._on_error class TaskSpecList(base.BaseSpecList): diff --git a/mistral/workbook/v2/workflows.py b/mistral/workbook/v2/workflows.py index 39a28c58..b1ebd2b6 100644 --- a/mistral/workbook/v2/workflows.py +++ b/mistral/workbook/v2/workflows.py @@ -49,6 +49,9 @@ class WorkflowSpec(base.BaseSpec): self._output = data.get('output', {}) # TODO(rakhmerov): Build workflow policies specification. self._policies = None + self._on_task_complete = self._as_list_of_tuples("on-task-complete") + self._on_task_success = self._as_list_of_tuples("on-task-success") + self._on_task_error = self._as_list_of_tuples("on-task-error") self._tasks = self._spec_property('tasks', tasks.TaskSpecList) @@ -71,13 +74,13 @@ class WorkflowSpec(base.BaseSpec): return self._policies def get_on_task_complete(self): - return self._as_list_of_tuples("on-task-complete") + return self._on_task_complete def get_on_task_success(self): - return self._as_list_of_tuples("on-task-success") + return self._on_task_success def get_on_task_error(self): - return self._as_list_of_tuples("on-task-error") + return self._on_task_error def get_tasks(self): return self._tasks