From f1640a11debdaf7d33fb72c3ef05ab68cdccd105 Mon Sep 17 00:00:00 2001 From: Steven Hardy Date: Tue, 26 Jun 2018 08:19:52 +0100 Subject: [PATCH] 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 --- workbooks/swift.yaml | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/workbooks/swift.yaml b/workbooks/swift.yaml index c8bc8c066..4a48ab239 100644 --- a/workbooks/swift.yaml +++ b/workbooks/swift.yaml @@ -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 %>