Fail the baremetal workflows when sending a "FAILED" message

When Mistral workflows execute a second workflow (a sub-workflow
execution), the parent workflow can't easily determine if sub-workflow
failed.  This is because the failure is communicated via a Zaqar message
only and when a workflow ends with a successful Zaqar message it appears
have been successful. This problem surfaces because parent workflows
should have an "on-error" attribute but it is never called, as the
workflow doesn't error.

This change marks the workflow as failed if the message has the status
"FAILED". Now when a sub-workflow fails, the task that called it should
have the on-error triggered. Previously it would always go to
on-success.

Closes-Bug: #1651704
Change-Id: I60444ec692351c44753649b59b7c1d7c4b61fa8e
This commit is contained in:
Dougal Matthews 2017-01-10 14:35:36 +00:00
parent a4592519e7
commit c7b01eba55
1 changed files with 56 additions and 0 deletions

View File

@ -88,6 +88,11 @@ workflows:
status: <% $.get('status', 'SUCCESS') %>
message: <% $.get('message', '') %>
execution: <% execution() %>
on-success:
- fail_workflow: <% $.get('status') = "FAILED" %>
fail_workflow:
action: std.fail
register_or_update:
description: Take nodes JSON and create nodes in a "manageable" state
@ -174,6 +179,12 @@ workflows:
message: <% $.get('message', '') %>
execution: <% execution() %>
registered_nodes: <% $.registered_nodes or [] %>
on-success:
- fail_workflow: <% $.get('status') = "FAILED" %>
fail_workflow:
action: std.fail
provide:
description: Take a list of nodes and move them to "available"
@ -233,6 +244,11 @@ workflows:
status: <% $.get('status', 'SUCCESS') %>
message: <% $.get('message', '') %>
execution: <% execution() %>
on-success:
- fail_workflow: <% $.get('status') = "FAILED" %>
fail_workflow:
action: std.fail
provide_manageable_nodes:
description: Provide all nodes in a 'manageable' state.
@ -276,6 +292,11 @@ workflows:
status: <% $.get('status', 'SUCCESS') %>
message: <% $.get('message', '') %>
execution: <% execution() %>
on-success:
- fail_workflow: <% $.get('status') = "FAILED" %>
fail_workflow:
action: std.fail
introspect:
description: Take a list of nodes and move them through introspection.
@ -322,6 +343,11 @@ workflows:
message: <% $.get('message', '') %>
execution: <% execution() %>
introspected_nodes: <% $.get('introspected_nodes', []) %>
on-success:
- fail_workflow: <% $.get('status') = "FAILED" %>
fail_workflow:
action: std.fail
introspect_manageable_nodes:
@ -376,6 +402,11 @@ workflows:
message: <% $.get('message', '') %>
execution: <% execution() %>
introspected_nodes: <% $.get('introspected_nodes', []) %>
on-success:
- fail_workflow: <% $.get('status') = "FAILED" %>
fail_workflow:
action: std.fail
configure:
description: Take a list of manageable nodes and update their boot configuration.
@ -431,6 +462,11 @@ workflows:
status: <% $.get('status', 'SUCCESS') %>
message: <% $.get('message', '') %>
execution: <% execution() %>
on-success:
- fail_workflow: <% $.get('status') = "FAILED" %>
fail_workflow:
action: std.fail
configure_manageable_nodes:
@ -494,6 +530,11 @@ workflows:
status: <% $.get('status', 'SUCCESS') %>
message: <% $.get('message', '') %>
execution: <% execution() %>
on-success:
- fail_workflow: <% $.get('status') = "FAILED" %>
fail_workflow:
action: std.fail
tag_node:
@ -527,6 +568,11 @@ workflows:
status: <% $.get('status', 'FAILED') %>
message: <% $.get('message', '') %>
execution: <% execution() %>
on-success:
- fail_workflow: <% $.get('status') = "FAILED" %>
fail_workflow:
action: std.fail
tag_nodes:
@ -581,6 +627,11 @@ workflows:
status: <% $.get('status', 'FAILED') %>
message: <% $.get('message', '') %>
execution: <% execution() %>
on-success:
- fail_workflow: <% $.get('status') = "FAILED" %>
fail_workflow:
action: std.fail
create_raid_configuration:
description: Create and apply RAID configuration for given nodes
@ -640,3 +691,8 @@ workflows:
status: <% $.get('status', 'FAILED') %>
message: <% $.get('message', '') %>
execution: <% execution() %>
on-success:
- fail_workflow: <% $.get('status') = "FAILED" %>
fail_workflow:
action: std.fail