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
This commit is contained in:
Dougal Matthews
2016-08-19 10:13:40 +00:00
parent d437418149
commit e797420e60

View File

@@ -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