From 9c7bd24720ca8b12ec8f9d05ee862bbcf3b2ebff Mon Sep 17 00:00:00 2001 From: Kevin Carter Date: Mon, 24 Feb 2020 09:20:00 -0600 Subject: [PATCH] Remove mistral when running the validate_nodes This change removes all of mistral from the validate_nodes workflow by calling the required functions directly. Story: 2007212 Task: 38440 Change-Id: Ic340fad0d7305188cf3bf33a73d36cd20fca4f6b Signed-off-by: Kevin Carter --- tripleoclient/workflows/baremetal.py | 37 +++++++++++----------------- 1 file changed, 14 insertions(+), 23 deletions(-) diff --git a/tripleoclient/workflows/baremetal.py b/tripleoclient/workflows/baremetal.py index 63d0a5fa8..07159440a 100644 --- a/tripleoclient/workflows/baremetal.py +++ b/tripleoclient/workflows/baremetal.py @@ -23,34 +23,25 @@ from tripleoclient import exceptions from tripleoclient.workflows import base -def validate_nodes(clients, **workflow_input): - """Node Registration or Update +def validate_nodes(clients, nodes_json): + """Validate nodes. - Run the tripleo.baremetal.v1.validate_nodes Mistral workflow. + :param clients: Application client object. + :type clients: Object + + :param nodes_json: + :type nodes_json: Object + + :returns: Boolean """ - workflow_client = clients.workflow_engine - tripleoclients = clients.tripleoclient - - with tripleoclients.messaging_websocket() as ws: - execution = base.start_workflow( - workflow_client, - 'tripleo.baremetal.v1.validate_nodes', - workflow_input=workflow_input - ) - - for payload in base.wait_for_messages(workflow_client, ws, execution): - if 'message' in payload: - print(payload['message']) - - if payload['status'] == 'SUCCESS': - print('Successfully validated environment file') + context = clients.tripleoclient.create_mistral_context() + nodes = baremetal.ValidateNodes(nodes_json=nodes_json) + validated_nodes = nodes.run(context=context) + if not validated_nodes: return True else: - raise exceptions.RegisterOrUpdateError( - 'Exception validating environment file: {}'.format( - payload['message']) - ) + raise exceptions.RegisterOrUpdateError(validated_nodes) def register_or_update(clients, **workflow_input):