Fail multiple executions of config-download of the same plan

Add an initial task to the config_download_deploy workflow that queries
for existing executions of the same workflow on the same plan. If any
are found, that means that config-download is already running on the
existing plan, so we should fail the additional one that is trying to
start.

Change-Id: I967ae5528834382b6ef69cc4dac10c893c907fc8
This commit is contained in:
James Slagle 2018-09-27 19:19:13 -04:00
parent 678d564619
commit 094ce5b250
2 changed files with 29 additions and 0 deletions

View File

@ -0,0 +1,7 @@
---
other:
- |
Add an initial task to the config_download_deploy workflow that queries for
existing executions of the same workflow on the same plan. If any are
found, that means that config-download is already running on the existing
plan, so the additional one that is trying to start is failed.

View File

@ -386,6 +386,28 @@ workflows:
tasks:
check_for_deploy_in_progress:
action: mistral.executions_find
input:
workflow_name: tripleo.deployment.v1.config_download_deploy
state: RUNNING
publish:
running_config_download_workflows: <% task().result.where($.id != execution().id) %>
on-success:
- fail_deploy_in_progress: <% $.running_config_download_workflows != [] %>
- get_blacklisted_hostnames: <% $.running_config_download_workflows = [] %>
fail_deploy_in_progress:
workflow: tripleo.messaging.v1.send
input:
queue_name: <% $.queue_name %>
type: <% execution().name %>
status: <% $.get('status', 'FAILED') %>
execution: <% execution() %>
message: Deployment already in progress with execution <% $.running_config_download_workflows[0].id %>
plan_name: <% $.plan_name %>
on-complete: fail
get_blacklisted_hostnames:
action: heat.stacks_output_show
input: