Improve workflow notifications and webhook data

The task_execution_id is required to be able to restore the hierarchy
of tasks and workflows on the notification receiver side. Also, including
the event in the notification is very useful.

Also fix the documentation as multiline strings are not supported in
ini files.

Change-Id: I714fd5c32b0f31f85ac5a4d22d161e662bf18687
This commit is contained in:
Andras Kovi 2019-09-03 16:21:20 +02:00
parent 99194bddc8
commit 5eb2a21607
3 changed files with 5 additions and 5 deletions

View File

@ -177,10 +177,7 @@ directory.
key value pairs to be passed as kwargs into the publisher::
[notifier]
notify = [
{'type': 'webhook', 'url': 'http://example.com', 'headers': {'X-Auth-Token': 'XXXX'}},
{'type': 'custom_publisher'}
]
notify = [ {"type": "webhook", "url": "http://example.com", "headers": {"X-Auth-Token": "XXXX"}}, {"type": "custom_publisher"} ]
#. Finally, try to run mistral engine and verify that it is running without
any error::

View File

@ -96,7 +96,8 @@ class Workflow(object):
"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
"project_id": self.wf_ex.project_id,
"task_execution_id": self.wf_ex.task_execution_id
}
def _send_notification():

View File

@ -29,6 +29,8 @@ class DefaultNotifier(base.Notifier):
def notify(self, ex_id, data, event, timestamp, publishers):
ctx = auth_ctx.ctx()
data['event'] = event
for entry in publishers:
params = copy.deepcopy(entry)
publisher_name = params.pop('type', None)