Add utility workflow to verify if an object exists

This will be used to check if e.g plan-environment.yaml exists
in a plan container.

Change-Id: Iabb5a7fecd0d6889f3cd65188396e23a23874648
This commit is contained in:
Steven Hardy 2018-06-26 08:19:52 +01:00
parent 648aa43675
commit f1640a11de
1 changed files with 30 additions and 0 deletions

View File

@ -47,3 +47,33 @@ workflows:
create_container:
action: swift.put_container
input: <% $.create_input %>
object_exists:
description: >-
Verify if a Swift object exists
Given the name of a Swift container and object this workflow will
verify if it already exists. The workflow will ERROR if it doesn't
and end in SUCCESS if it does.
input:
- container
- object
tags:
- tripleo-common-managed
tasks:
get_objects:
action: swift.get_container
input:
container: <% $.container %>
prefix: <% $.object %>
publish:
object_exists: <% bool(task().result) and $.object in task().result[1].select($.name) %>
on-success:
- succeed: <% $.object_exists %>
- fail: <% not $.object_exists %>