From a57bd4868d1b9399aa4f61870f40ea412069ebd1 Mon Sep 17 00:00:00 2001 From: James Slagle Date: Tue, 25 Sep 2018 08:29:17 -0400 Subject: [PATCH] Use sync action get_deployment_failures Instead of using the workflow, which has the extra overhead of opening a websocket and polling for messages and the workflow result, just use the mistral action for get_deployment_failures directly. This is much simpler. It also fixes a bug where messages from other running workflows using the same "tripleo" queue were polluting the output of the "overcloud failures" command. Change-Id: Ie774a5698515ba7e43dc0755042fb476eb241fc7 Closes-Bug: #1794277 (cherry picked from commit ec2e018457fd787337a7c1951672f6e1c3bfd8bb) --- tripleoclient/workflows/deployment.py | 25 ++++++++----------------- 1 file changed, 8 insertions(+), 17 deletions(-) diff --git a/tripleoclient/workflows/deployment.py b/tripleoclient/workflows/deployment.py index 7018cf05c..d172f047d 100644 --- a/tripleoclient/workflows/deployment.py +++ b/tripleoclient/workflows/deployment.py @@ -398,23 +398,14 @@ def set_deployment_status(clients, status='success', **workflow_input): def get_deployment_failures(clients, **workflow_input): workflow_client = clients.workflow_engine - tripleoclients = clients.tripleoclient - with tripleoclients.messaging_websocket() as ws: - execution = base.start_workflow( - workflow_client, - 'tripleo.deployment.v1.get_deployment_failures', - workflow_input=workflow_input - ) + result = base.call_action( + workflow_client, + 'tripleo.deployment.get_deployment_failures', + **workflow_input + ) - for payload in base.wait_for_messages(workflow_client, ws, execution, - _WORKFLOW_TIMEOUT): - if 'message' in payload: - print(payload['message']) + if result.get('message', ''): + print(result['message']) - if payload['status'] == 'SUCCESS': - return payload['deployment_failures']['failures'] - else: - raise exceptions.WorkflowServiceError( - 'Exception getting deployment failures: {}'.format( - payload.get('message', ''))) + return result['failures']