Fail the plan_management 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.

Change-Id: Ie0f1d4e57505e9346ae3f0b25d755f55d73a255a
Related-Bug: #1651704
This commit is contained in:
Dougal Matthews 2017-01-11 14:16:50 +00:00
parent a4592519e7
commit ab946c4a0e
1 changed files with 20 additions and 0 deletions

View File

@ -61,6 +61,11 @@ workflows:
status: <% $.status %>
message: <% $.message or '' %>
execution: <% execution() %>
on-success:
- fail_workflow: <% $.get('status') = "FAILED" %>
fail_workflow:
action: std.fail
update_deployment_plan:
input:
@ -119,6 +124,11 @@ workflows:
status: <% $.status %>
message: <% $.message or '' %>
execution: <% execution() %>
on-success:
- fail_workflow: <% $.get('status') = "FAILED" %>
fail_workflow:
action: std.fail
create_default_deployment_plan:
input:
@ -215,6 +225,11 @@ workflows:
status: <% $.status %>
message: <% $.message or '' %>
execution: <% execution() %>
on-success:
- fail_workflow: <% $.get('status') = "FAILED" %>
fail_workflow:
action: std.fail
get_passwords:
description: Retrieves passwords for a given plan
@ -274,3 +289,8 @@ workflows:
status: <% $.status %>
message: <% $.message or '' %>
execution: <% execution() %>
on-success:
- fail_workflow: <% $.get('status') = "FAILED" %>
fail_workflow:
action: std.fail