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 ec2e018457)
This commit is contained in:
James Slagle 2018-09-25 08:29:17 -04:00 committed by Emilien Macchi
parent c6dbdd0c5f
commit a57bd4868d
1 changed files with 8 additions and 17 deletions

View File

@ -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']