def clean_nodes(clients, **workflow_input): """Clean Baremetal Nodes Run the tripleo.baremetal.v1.clean_nodes Mistral workflow. """ workflow_client = clients.workflow_engine tripleoclients = clients.tripleoclient with tripleoclients.messaging_websocket() as ws: execution = base.start_workflow( workflow_client, 'tripleo.baremetal.v1.clean_nodes', workflow_input={'node_uuids': workflow_input['node_uuids']}) for payload in base.wait_for_messages(workflow_client, ws, execution): if payload.get('message'): print(payload['message']) if payload['status'] != 'SUCCESS': message = _format_errors(payload) raise exceptions.NodeConfigurationError( 'Error(s) cleaning nodes:\n{}'.format(message)) print('Successfully cleaned nodes')
def configure_manageable_nodes(clients, **workflow_input): """Configure all manageable Nodes. Run the tripleo.baremetal.v1.configure_manageable_nodes Mistral workflow. """ workflow_client = clients.workflow_engine ooo_client = clients.tripleoclient with ooo_client.messaging_websocket() as ws: execution = base.start_workflow( workflow_client, 'tripleo.baremetal.v1.configure_manageable_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': raise exceptions.NodeConfigurationError( 'Exception configuring nodes: {}'.format(payload['message'])) print(payload['message'])
def configure(clients, **workflow_input): """Configure Node boot options. Run the tripleo.baremetal.v1.configure Mistral workflow. """ workflow_client = clients.workflow_engine ooo_client = clients.tripleoclient queue_name = workflow_input['queue_name'] execution = workflow_client.executions.create( 'tripleo.baremetal.v1.configure', workflow_input=workflow_input) with ooo_client.messaging_websocket(queue_name) as ws: payload = ws.wait_for_message(execution.id) if payload['status'] != 'SUCCESS': raise exceptions.NodeConfigurationError( 'Failed to configure nodes: {}'.format(payload['message']))
def clean_manageable_nodes(clients, **workflow_input): """Clean all manageable Nodes Run the tripleo.baremetal.v1.clean_manageable_nodes Mistral workflow. """ workflow_client = clients.workflow_engine tripleoclients = clients.tripleoclient with tripleoclients.messaging_websocket() as ws: execution = base.start_workflow( workflow_client, 'tripleo.baremetal.v1.clean_manageable_nodes', workflow_input=workflow_input) for payload in base.wait_for_messages(workflow_client, ws, execution): if payload.get('message'): print(payload['message']) if payload['status'] != 'SUCCESS': raise exceptions.NodeConfigurationError( 'Error cleaning nodes: {}'.format(payload['message'])) print('Cleaned %d node(s)' % len(payload['cleaned_nodes']))
def undeploy_roles(clients, **workflow_input): """Undeploy provided roles using Ironic. Run the tripleo.baremetal_deploy.v1.undeploy_roles Mistral workflow. """ workflow_client = clients.workflow_engine tripleoclients = clients.tripleoclient with tripleoclients.messaging_websocket() as ws: execution = base.start_workflow( workflow_client, 'tripleo.baremetal_deploy.v1.undeploy_roles', workflow_input=workflow_input) for payload in base.wait_for_messages(workflow_client, ws, execution): if payload.get('message'): print(payload['message']) if payload['status'] != 'SUCCESS': raise exceptions.NodeConfigurationError( 'Error undeploying nodes: {}'.format(payload['message'])) return payload