Use the builtin Mistral engine command 'fail' when failing workflows

In changes 12f7345, c2fb9b0, 6051a74, c7b01eb and ab946c4 Mistral
Workflows were marked as failed if they sent a Zaqar message with the
status "FAILED". This is correct, but it turns out there is an easier
way to do it.

Mistral has a engine command designed for this purpose, using it removes
some of the duplication we have incurred.

We use on-success rather than on-complete to surface the best error on
the workflow. If the Zaqar queue post fails, then the workflow will fail
with this error. If, on-complete we then manually mark the workflow as
failed it will ovrwrite the Zaqar error with a generic one.

Closes-Bug: #1664918
Related-Bug: #1651704
Change-Id: I9ef9cfef1b8740a535e005769ec0c3ad67ecb103
This commit is contained in:
Dougal Matthews 2017-01-25 08:06:27 +00:00
parent 23977cd4d8
commit 5435d9d823
7 changed files with 31 additions and 105 deletions

View File

@ -89,10 +89,7 @@ workflows:
message: <% $.get('message', '') %>
execution: <% execution() %>
on-success:
- fail_workflow: <% $.get('status') = "FAILED" %>
fail_workflow:
action: std.fail
- fail: <% $.get('status') = "FAILED" %>
register_or_update:
description: Take nodes JSON and create nodes in a "manageable" state
@ -177,11 +174,7 @@ workflows:
execution: <% execution() %>
registered_nodes: <% $.registered_nodes or [] %>
on-success:
- fail_workflow: <% $.get('status') = "FAILED" %>
fail_workflow:
action: std.fail
- fail: <% $.get('status') = "FAILED" %>
provide:
description: Take a list of nodes and move them to "available"
@ -272,10 +265,7 @@ workflows:
message: <% $.get('message', '') %>
execution: <% execution() %>
on-success:
- fail_workflow: <% $.get('status') = "FAILED" %>
fail_workflow:
action: std.fail
- fail: <% $.get('status') = "FAILED" %>
provide_manageable_nodes:
description: Provide all nodes in a 'manageable' state.
@ -320,10 +310,7 @@ workflows:
message: <% $.get('message', '') %>
execution: <% execution() %>
on-success:
- fail_workflow: <% $.get('status') = "FAILED" %>
fail_workflow:
action: std.fail
- fail: <% $.get('status') = "FAILED" %>
manage:
description: Set a list of nodes to 'manageable' state
@ -363,10 +350,7 @@ workflows:
message: <% $.get('message', '') %>
execution: <% execution() %>
on-success:
- fail_workflow: <% $.get('status') = "FAILED" %>
fail_workflow:
action: std.fail
- fail: <% $.get('status') = "FAILED" %>
introspect:
description: Take a list of nodes and move them through introspection.
@ -434,11 +418,7 @@ workflows:
execution: <% execution() %>
introspected_nodes: <% $.get('introspected_nodes', []) %>
on-success:
- fail_workflow: <% $.get('status') = "FAILED" %>
fail_workflow:
action: std.fail
- fail: <% $.get('status') = "FAILED" %>
introspect_manageable_nodes:
description: Introspect all nodes in a 'manageable' state.
@ -495,10 +475,7 @@ workflows:
execution: <% execution() %>
introspected_nodes: <% $.get('introspected_nodes', []) %>
on-success:
- fail_workflow: <% $.get('status') = "FAILED" %>
fail_workflow:
action: std.fail
- fail: <% $.get('status') = "FAILED" %>
configure:
description: Take a list of manageable nodes and update their boot configuration.
@ -555,11 +532,7 @@ workflows:
message: <% $.get('message', '') %>
execution: <% execution() %>
on-success:
- fail_workflow: <% $.get('status') = "FAILED" %>
fail_workflow:
action: std.fail
- fail: <% $.get('status') = "FAILED" %>
configure_manageable_nodes:
description: Update the boot configuration of all nodes in 'manageable' state.
@ -623,11 +596,7 @@ workflows:
message: <% $.get('message', '') %>
execution: <% execution() %>
on-success:
- fail_workflow: <% $.get('status') = "FAILED" %>
fail_workflow:
action: std.fail
- fail: <% $.get('status') = "FAILED" %>
tag_node:
description: Tag a node with a role
@ -661,11 +630,7 @@ workflows:
message: <% $.get('message', '') %>
execution: <% execution() %>
on-success:
- fail_workflow: <% $.get('status') = "FAILED" %>
fail_workflow:
action: std.fail
- fail: <% $.get('status') = "FAILED" %>
tag_nodes:
description: Runs the tag_node workflow in a loop
@ -720,10 +685,7 @@ workflows:
message: <% $.get('message', '') %>
execution: <% execution() %>
on-success:
- fail_workflow: <% $.get('status') = "FAILED" %>
fail_workflow:
action: std.fail
- fail: <% $.get('status') = "FAILED" %>
create_raid_configuration:
description: Create and apply RAID configuration for given nodes
@ -784,10 +746,7 @@ workflows:
message: <% $.get('message', '') %>
execution: <% execution() %>
on-success:
- fail_workflow: <% $.get('status') = "FAILED" %>
fail_workflow:
action: std.fail
- fail: <% $.get('status') = "FAILED" %>
cellv2_discovery:
@ -823,7 +782,4 @@ workflows:
message: <% $.get('message', '') %>
execution: <% execution() %>
on-success:
- fail_workflow: <% $.get('status') = "FAILED" %>
fail_workflow:
action: std.fail
- fail: <% $.get('status') = "FAILED" %>

View File

@ -43,10 +43,7 @@ workflows:
stderr: <% task(deploy_config).result.deploy_stderr %>
execution: <% execution() %>
on-success:
- fail_workflow: <% $.get('status') = "FAILED" %>
fail_workflow:
action: std.fail
- fail: <% $.get('status') = "FAILED" %>
deploy_on_servers:
@ -102,10 +99,7 @@ workflows:
status: FAILED
message: <% task(deploy_on_servers).result %>
execution: <% execution() %>
on-success: fail_workflow
fail_workflow:
action: std.fail
on-success: fail
deploy_plan:
@ -225,7 +219,4 @@ workflows:
message: <% $.get('message', '') %>
execution: <% execution() %>
on-success:
- fail_workflow: <% $.get('status') = "FAILED" %>
fail_workflow:
action: std.fail
- fail: <% $.get('status') = "FAILED" %>

View File

@ -37,6 +37,8 @@ workflows:
status: <% $.get('status', 'SUCCESS') %>
message: <% $.get('message', '') %>
execution: <% execution() %>
on-success:
- fail: <% $.get('status') = "FAILED" %>
# Clear an update breakpoint
clear_breakpoints:
@ -70,6 +72,8 @@ workflows:
status: <% $.get('status', 'SUCCESS') %>
message: <% $.get('message', '') %>
execution: <% execution() %>
on-success:
- fail: <% $.get('status') = "FAILED" %>
cancel_stack_update:
description: Cancel a currently running stack update
@ -101,3 +105,5 @@ workflows:
status: <% $.get('status', 'SUCCESS') %>
message: <% $.get('message', '') %>
execution: <% execution() %>
on-success:
- fail: <% $.get('status') = "FAILED" %>

View File

@ -65,10 +65,7 @@ workflows:
message: <% $.message or '' %>
execution: <% execution() %>
on-success:
- fail_workflow: <% $.get('status') = "FAILED" %>
fail_workflow:
action: std.fail
- fail: <% $.get('status') = "FAILED" %>
update_deployment_plan:
input:
@ -131,10 +128,7 @@ workflows:
message: <% $.message or '' %>
execution: <% execution() %>
on-success:
- fail_workflow: <% $.get('status') = "FAILED" %>
fail_workflow:
action: std.fail
- fail: <% $.get('status') = "FAILED" %>
create_default_deployment_plan:
input:
@ -235,10 +229,7 @@ workflows:
message: <% $.message or '' %>
execution: <% execution() %>
on-success:
- fail_workflow: <% $.get('status') = "FAILED" %>
fail_workflow:
action: std.fail
- fail: <% $.get('status') = "FAILED" %>
get_passwords:
description: Retrieves passwords for a given plan
@ -299,7 +290,4 @@ workflows:
message: <% $.message or '' %>
execution: <% execution() %>
on-success:
- fail_workflow: <% $.get('status') = "FAILED" %>
fail_workflow:
action: std.fail
- fail: <% $.get('status') = "FAILED" %>

View File

@ -62,7 +62,4 @@ workflows:
message: <% $.get('message', '') %>
execution: <% execution() %>
on-success:
- fail_workflow: <% $.get('status') = "FAILED" %>
fail_workflow:
action: std.fail
- fail: <% $.get('status') = "FAILED" %>

View File

@ -101,7 +101,4 @@ workflows:
message: <% $.get('message', '') %>
execution: <% execution() %>
on-success:
- fail_workflow: <% $.get('status') = "FAILED" %>
fail_workflow:
action: std.fail
- fail: <% $.get('status') = "FAILED" %>

View File

@ -60,10 +60,7 @@ workflows:
stderr: <% $.stderr %>
execution: <% execution() %>
on-success:
- fail_workflow: <% $.get('status') = "FAILED" %>
fail_workflow:
action: std.fail
- fail: <% $.get('status') = "FAILED" %>
run_validations:
input:
@ -115,10 +112,7 @@ workflows:
status: <% $.get('status', 'SUCCESS') %>
execution: <% execution() %>
on-success:
- fail_workflow: <% $.get('status') = "FAILED" %>
fail_workflow:
action: std.fail
- fail: <% $.get('status') = "FAILED" %>
run_groups:
input:
@ -178,10 +172,7 @@ workflows:
status: <% $.get('status', 'SUCCESS') %>
execution: <% execution() %>
on-success:
- fail_workflow: <% $.get('status') = "FAILED" %>
fail_workflow:
action: std.fail
- fail: <% $.get('status') = "FAILED" %>
list:
input: