From 4c124f6559ae8b17f1634784a0e4ceae81994b23 Mon Sep 17 00:00:00 2001 From: Dougal Matthews Date: Tue, 20 Mar 2018 14:01:11 +0000 Subject: [PATCH] Use the standard messaging in the fernet-key-rotate workbook Update the fernet-key-rotate workbook to use the standard message sending workflow. This workflow reduces the boilerplate that is copied between workflows by defining the message structure, providing the retry logic and ensuring the task on a "FAILED" message. The workflow also offers optional persistence in Swift. If the plan name is given to the workflow it will store the messages in a Swift container named -messages. Related-Bug: #1757372 Change-Id: I5087b777a24700c0d99c42db9ead64933674247b --- workbooks/fernet-key-rotate.yaml | 28 ++++++++++++---------------- 1 file changed, 12 insertions(+), 16 deletions(-) diff --git a/workbooks/fernet-key-rotate.yaml b/workbooks/fernet-key-rotate.yaml index c64dc8420..31c5dbaf0 100644 --- a/workbooks/fernet-key-rotate.yaml +++ b/workbooks/fernet-key-rotate.yaml @@ -21,7 +21,7 @@ workflows: rotate_keys: action: tripleo.parameters.rotate_fernet_keys container=<% $.container %> on-success: deploy_ssh_key - on-error: notify_zaqar + on-error: send_message publish-on-error: status: FAILED message: <% task().result %> @@ -29,7 +29,7 @@ workflows: deploy_ssh_key: workflow: tripleo.validations.v1.copy_ssh_key on-success: get_privkey - on-error: notify_zaqar + on-error: send_message publish-on-error: status: FAILED message: <% task().result %> @@ -37,7 +37,7 @@ workflows: get_privkey: action: tripleo.validations.get_privkey on-success: deploy_keys - on-error: notify_zaqar + on-error: send_message publish-on-error: status: FAILED message: <% task().result %> @@ -56,25 +56,21 @@ workflows: fernet_keys: <% task(rotate_keys).result %> use_openstack_credentials: true playbook: /usr/share/tripleo-common/playbooks/rotate-keys.yaml - on-success: notify_zaqar + on-success: send_message publish: status: SUCCESS message: <% task().result %> - on-error: notify_zaqar + on-error: send_message publish-on-error: status: FAILED message: <% task().result %> - notify_zaqar: - action: zaqar.queue_post + send_message: + workflow: tripleo.messaging.v1.send input: queue_name: <% $.queue_name %> - messages: - body: - type: tripleo.fernet_keys.v1.rotate_fernet_keys - payload: - status: <% $.status %> - message: <% $.get('message', '') %> - execution: <% execution() %> - on-success: - - fail: <% $.get('status') = "FAILED" %> + type: <% execution().name %> + status: <% $.status %> + message: <% $.get('message', '') %> + execution: <% execution() %> + plan_name: <% $.container %>