tripleo-common/workbooks/swift_rings_backup.yaml
Dougal Matthews 4ad2410d68 Correct the container name confusion in the swift rings workflow
The create_swift_rings_backup_container_plan workflow switches between
using the overcloud swift container and the overcloud-swift-rings
container (if given the input "overcloud"). This patch determines the
container name in one place and updates all uses.

While refactoring it also removes the duplication of the
swift-rings.tar.gz file name.

Closes-Bug: #1736998
Change-Id: I5f988b003ed9600a530868dedc911a4f1333e730
2017-12-11 10:28:14 +00:00

97 lines
2.8 KiB
YAML

---
version: '2.0'
name: tripleo.swift_rings_backup.v1
description: TripleO Swift Rings backup container Deployment Workflow v1
workflows:
create_swift_rings_backup_container_plan:
description: >
This plan ensures existence of container for Swift Rings backup.
input:
- container
- queue_name: tripleo
tags:
- tripleo-common-managed
tasks:
swift_rings_container:
publish:
swift_rings_container: "<% $.container %>-swift-rings"
swift_rings_tar: "swift-rings.tar.gz"
on-complete: check_container
check_container:
action: swift.head_container container=<% $.swift_rings_container %>
on-success: get_tempurl
on-error: create_container
create_container:
action: tripleo.plan.create_container container=<% $.swift_rings_container %>
on-error: set_create_container_failed
on-success: get_tempurl
get_tempurl:
action: tripleo.swift.tempurl
on-success: set_get_tempurl
input:
container: <% $.swift_rings_container %>
obj: <% $.swift_rings_tar %>
set_get_tempurl:
action: tripleo.parameters.update
input:
parameters:
SwiftRingGetTempurl: <% task(get_tempurl).result %>
container: <% $.container %>
on-success: put_tempurl
put_tempurl:
action: tripleo.swift.tempurl
on-success: set_put_tempurl
input:
container: <% $.swift_rings_container %>
obj: <% $.swift_rings_tar %>
method: "PUT"
set_put_tempurl:
action: tripleo.parameters.update
input:
parameters:
SwiftRingPutTempurl: <% task(put_tempurl).result %>
container: <% $.container %>
on-success: set_status_success
on-error: set_put_tempurl_failed
set_status_success:
on-success: notify_zaqar
publish:
status: SUCCESS
message: <% task(set_put_tempurl).result %>
set_put_tempurl_failed:
on-success: notify_zaqar
publish:
status: FAILED
message: <% task(set_put_tempurl).result %>
set_create_container_failed:
on-success: notify_zaqar
publish:
status: FAILED
message: <% task(create_container).result %>
notify_zaqar:
action: zaqar.queue_post
input:
queue_name: <% $.queue_name %>
messages:
body:
type: tripleo.swift_rings_backup.v1.create_swift_rings_backup_container_plan
payload:
status: <% $.status %>
message: <% $.get('message', '') %>
execution: <% execution() %>
on-success:
- fail: <% $.get('status') = "FAILED" %>