diff --git a/mistral/engine/tasks.py b/mistral/engine/tasks.py index b4d5cd81b..08102c260 100644 --- a/mistral/engine/tasks.py +++ b/mistral/engine/tasks.py @@ -76,10 +76,23 @@ class Task(object): notifier = notif.get_notifier(cfg.CONF.notifier.type) event = events.identify_task_event(old_task_state, new_task_state) + def _convert_to_notification_data(): + return { + "id": self.task_ex.id, + "name": self.task_ex.name, + "workflow_name": self.task_ex.workflow_name, + "workflow_namespace": self.task_ex.workflow_namespace, + "workflow_id": self.task_ex.workflow_id, + "state": self.task_ex.state, + "state_info": self.task_ex.state_info, + "type": self.task_ex.type, + "project_id": self.task_ex.project_id + } + def _send_notification(): notifier.notify( self.task_ex.id, - self.task_ex.to_dict(), + _convert_to_notification_data(), event, self.task_ex.updated_at, publishers diff --git a/mistral/engine/workflows.py b/mistral/engine/workflows.py index d3bb7ccc4..aa97ee328 100644 --- a/mistral/engine/workflows.py +++ b/mistral/engine/workflows.py @@ -74,10 +74,22 @@ class Workflow(object): notifier = notif.get_notifier(cfg.CONF.notifier.type) + def _convert_to_notification_data(): + return { + "id": self.wf_ex.id, + "name": self.wf_ex.name, + "workflow_name": self.wf_ex.workflow_name, + "workflow_namespace": self.wf_ex.workflow_namespace, + "workflow_id": self.wf_ex.workflow_id, + "state": self.wf_ex.state, + "state_info": self.wf_ex.state_info, + "project_id": self.wf_ex.project_id + } + def _send_notification(): notifier.notify( self.wf_ex.id, - self.wf_ex.to_dict(), + _convert_to_notification_data(), event, self.wf_ex.updated_at, publishers