From e797420e6098fff911be4e500eeb1bc9c4a50a2a Mon Sep 17 00:00:00 2001 From: Dougal Matthews Date: Fri, 19 Aug 2016 10:13:40 +0000 Subject: [PATCH] Verify that neither the Swift container or Mistral environment exist Without this check it is possible for create plan to get into a partial state. If the Mistral environment exists, but the swift container doesn't then it will create the container and error when attempting to create the environment. There is still a possibility of a race condition, but this verification greatly reduces that risk. Change-Id: I18dee67c5935248a32b3b90241e3bbdd02034677 Closes-Bug: 1613196 --- workbooks/plan_management.yaml | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/workbooks/plan_management.yaml b/workbooks/plan_management.yaml index 2ef3366ae..78ea6c8f2 100644 --- a/workbooks/plan_management.yaml +++ b/workbooks/plan_management.yaml @@ -46,6 +46,23 @@ workflows: - container - queue_name: tripleo tasks: + + verify_container_doesnt_exist: + action: swift.head_container container=<% $.container %> + on-success: notify_zaqar + on-error: verify_environment_doesnt_exist + publish: + status: FAILED + message: "Unable to create plan. The Swift container already exists" + + verify_environment_doesnt_exist: + action: mistral.environments_get name=<% $.container %> + on-success: notify_zaqar + on-error: create_container + publish: + status: FAILED + message: "Unable to create plan. The Mistral environment already exists" + create_container: action: tripleo.create_container container=<% $.container %> on-success: upload_to_container