2019-12-20 11:53:26 |
ITD27M01 |
description |
We use the event engine for managing DNS records with Designate service. To create "PTR" records for each "A" record, the following event trigger used:
{
"Workflow ID": "feb60678-669f-458f-bca0-ea39dd7bdb8a",
"Exchange": "designate",
"Event": "dns.recordset.create",
"Topic": "notifications",
"Params": "{}",
"Updated at": null,
"ID": "414be2c6-b692-42b9-a745-842955a54138",
"Created at": "2019-12-18 16:42:16",
"Name": "cloud.events.dns.create_ptr"
}
Here is an example of event_definitions.yaml for such events:
cat /etc/mistral/event_definitions.yaml
- event_types:
- dns.*
properties:
event: <% $ %>
project_id: <% $.context.project %>
user_id: <% $.context.user %>
The problem is context from service has attributes <user> and <project> but not <user_id> and <project_id> [1], [2], [3]. Here is an example of an event:
"event": {
"publisher": "central.172.30.0.134",
"context": {
"domain": null,
"project_domain": null,
"auth_token": "gAAAAABd_Jfa9ELieG6_mXivzbdkTqaprOKRzAXYvQH0NXyD8AKfbqJ22ppjtTHg26wrln8TCLJWscHsv8YowSfQl70Fs9NBSdgrCqJ-BFTTqvDMPfLXLWnLcevK4CCrPWW7dsKllRGvs3KqWkQSnVBtoDj4Wy6QZKuIKtKJIPMgv35Su70-pmSg5VUCkkVHLqVcfOT1wx4z",
"resource_uuid": null,
"original_tenant": null,
"read_only": false,
"system_scope": null,
"user_identity": "ad64ce5e9890b9596163edd10c8a4da2bca62c4f84f720b59cf30d20903c60ab 975d866668854d14b6cb37d6a9780172 - - -",
"is_admin_project": true,
"hide_counts": false,
"client_timeout": null,
"global_request_id": null,
"is_admin": false,
"user": "ad64ce5e9890b9596163edd10c8a4da2bca62c4f84f720b59cf30d20903c60ab",
"service_catalog": []
"tsigkey_id": null,
"all_tenants": false,
"tenant": "975d866668854d14b6cb37d6a9780172",
"show_deleted": false,
"roles": [
"admin"
],
"edit_managed_records": false,
"client_addr": "172.30.44.64",
"project": "975d866668854d14b6cb37d6a9780172",
"request_id": "req-a272bad3-8621-401f-9584-11f7dcfb715c",
"abandon": null,
"user_domain": null
},
"event_type": "dns.recordset.create",
"timestamp": "2019-12-20 09:43:59.434517",
"payload": {
"zone_id": "70a6c3e9-fbd7-4b9a-beb5-841046754de3",
"tenant_id": "975d866668854d14b6cb37d6a9780172",
"created_at": "2019-12-20T09:43:59.393688",
"description": "None",
"updated_at": null,
"records": [
{
"status": "PENDING",
"zone_id": "70a6c3e9-fbd7-4b9a-beb5-841046754de3",
"managed": false,
"managed_resource_id": null,
"managed_resource_type": null,
"tenant_id": "975d866668854d14b6cb37d6a9780172",
"created_at": "2019-12-20T09:43:59.405292",
"managed_extra": null,
"updated_at": null,
"managed_plugin_type": null,
"version": 1,
"managed_plugin_name": null,
"managed_tenant_id": null,
"action": "CREATE",
"hash": "0ee96e7ffa25e0a81485d7200bc55e11",
"managed_resource_region": null,
"recordset_id": "440305dc-f31a-4c0e-abbb-e626f3beec5b",
"data": "srv8-jobscdc.delivery.cloud",
"id": "2d0acbcb-b5f6-4a10-adee-b8c5c7b1b02b",
"serial": 1576835039,
"description": null
}
],
"version": 1,
"ttl": null,
"zone_name": "176.30.172.in-addr.arpa.",
"type": "PTR",
"id": "440305dc-f31a-4c0e-abbb-e626f3beec5b",
"name": "213.176.30.172.in-addr.arpa."
}
}
As a result, the trigger cannot start the workflow because default_event_engine cannot match the context with the event trigger owner.
https://github.com/openstack/mistral/blob/master/mistral/event_engine/default_event_engine.py#L295
https://github.com/openstack/mistral/blob/master/mistral/event_engine/default_event_engine.py#L44
https://github.com/openstack/mistral/blob/master/mistral/event_engine/default_event_engine.py#L45 |
We use the event engine for managing DNS records with Designate service. To create "PTR" records for each "A" record, the following event trigger used:
{
"Workflow ID": "feb60678-669f-458f-bca0-ea39dd7bdb8a",
"Exchange": "designate",
"Event": "dns.recordset.create",
"Topic": "notifications",
"Params": "{}",
"Updated at": null,
"ID": "414be2c6-b692-42b9-a745-842955a54138",
"Created at": "2019-12-18 16:42:16",
"Name": "cloud.events.dns.create_ptr"
}
Here is an example of event_definitions.yaml for such events:
cat /etc/mistral/event_definitions.yaml
- event_types:
- dns.*
properties:
event: <% $ %>
project_id: <% $.context.project %>
user_id: <% $.context.user %>
The problem is context from service has attributes <user> and <project> but not <user_id> and <project_id> [1], [2], [3]. Here is an example of an event:
"event": {
"publisher": "central.172.30.0.134",
"context": {
"domain": null,
"project_domain": null,
"auth_token": "gAAAAABd_Jfa9ELieG6_mXivzbdkTqaprOKRzAXYvQH0NXyD8AKfbqJ22ppjtTHg26wrln8TCLJWscHsv8YowSfQl70Fs9NBSdgrCqJ-BFTTqvDMPfLXLWnLcevK4CCrPWW7dsKllRGvs3KqWkQSnVBtoDj4Wy6QZKuIKtKJIPMgv35Su70-pmSg5VUCkkVHLqVcfOT1wx4z",
"resource_uuid": null,
"original_tenant": null,
"read_only": false,
"system_scope": null,
"user_identity": "ad64ce5e9890b9596163edd10c8a4da2bca62c4f84f720b59cf30d20903c60ab 975d866668854d14b6cb37d6a9780172 - - -",
"is_admin_project": true,
"hide_counts": false,
"client_timeout": null,
"global_request_id": null,
"is_admin": false,
"user": "ad64ce5e9890b9596163edd10c8a4da2bca62c4f84f720b59cf30d20903c60ab",
"service_catalog": []
"tsigkey_id": null,
"all_tenants": false,
"tenant": "975d866668854d14b6cb37d6a9780172",
"show_deleted": false,
"roles": [
"admin"
],
"edit_managed_records": false,
"client_addr": "172.30.44.64",
"project": "975d866668854d14b6cb37d6a9780172",
"request_id": "req-a272bad3-8621-401f-9584-11f7dcfb715c",
"abandon": null,
"user_domain": null
},
"event_type": "dns.recordset.create",
"timestamp": "2019-12-20 09:43:59.434517",
"payload": {
"zone_id": "70a6c3e9-fbd7-4b9a-beb5-841046754de3",
"tenant_id": "975d866668854d14b6cb37d6a9780172",
"created_at": "2019-12-20T09:43:59.393688",
"description": "None",
"updated_at": null,
"records": [
{
"status": "PENDING",
"zone_id": "70a6c3e9-fbd7-4b9a-beb5-841046754de3",
"managed": false,
"managed_resource_id": null,
"managed_resource_type": null,
"tenant_id": "975d866668854d14b6cb37d6a9780172",
"created_at": "2019-12-20T09:43:59.405292",
"managed_extra": null,
"updated_at": null,
"managed_plugin_type": null,
"version": 1,
"managed_plugin_name": null,
"managed_tenant_id": null,
"action": "CREATE",
"hash": "0ee96e7ffa25e0a81485d7200bc55e11",
"managed_resource_region": null,
"recordset_id": "440305dc-f31a-4c0e-abbb-e626f3beec5b",
"data": "srv8-jobscdc.delivery.cloud",
"id": "2d0acbcb-b5f6-4a10-adee-b8c5c7b1b02b",
"serial": 1576835039,
"description": null
}
],
"version": 1,
"ttl": null,
"zone_name": "176.30.172.in-addr.arpa.",
"type": "PTR",
"id": "440305dc-f31a-4c0e-abbb-e626f3beec5b",
"name": "213.176.30.172.in-addr.arpa."
}
}
As a result, the trigger cannot start the workflow because default_event_engine cannot match the context with the event trigger owner.
[1] https://github.com/openstack/mistral/blob/master/mistral/event_engine/default_event_engine.py#L295
[2] https://github.com/openstack/mistral/blob/master/mistral/event_engine/default_event_engine.py#L44
[3] https://github.com/openstack/mistral/blob/master/mistral/event_engine/default_event_engine.py#L45 |
|