Merge "Reduce number of fields in notification data"

This commit is contained in:
Zuul 2019-06-10 12:33:32 +00:00 committed by Gerrit Code Review
commit 30b660bedb
2 changed files with 27 additions and 2 deletions

View File

@ -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

View File

@ -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