Print the execution ID when starting Mistral workflows
Change-Id: I9d77880e82ec429a2ea340df87c89055a09e9720
This commit is contained in:
parent
c0f79d4477
commit
14191e3eb9
@ -12,7 +12,10 @@
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
from __future__ import print_function
|
||||
|
||||
from tripleoclient import exceptions
|
||||
from tripleoclient.workflows import base
|
||||
|
||||
|
||||
def register_or_update(clients, **workflow_input):
|
||||
@ -25,7 +28,8 @@ def register_or_update(clients, **workflow_input):
|
||||
tripleoclients = clients.tripleoclient
|
||||
queue_name = workflow_input['queue_name']
|
||||
|
||||
execution = workflow_client.executions.create(
|
||||
execution = base.start_workflow(
|
||||
workflow_client,
|
||||
'tripleo.baremetal.v1.register_or_update',
|
||||
workflow_input=workflow_input
|
||||
)
|
||||
@ -53,7 +57,8 @@ def provide(clients, **workflow_input):
|
||||
tripleoclients = clients.tripleoclient
|
||||
queue_name = workflow_input['queue_name']
|
||||
|
||||
execution = workflow_client.executions.create(
|
||||
execution = base.start_workflow(
|
||||
workflow_client,
|
||||
'tripleo.baremetal.v1.provide',
|
||||
workflow_input={'node_uuids': workflow_input['node_uuids'],
|
||||
'queue_name': queue_name}
|
||||
@ -80,7 +85,8 @@ def introspect(clients, **workflow_input):
|
||||
tripleoclients = clients.tripleoclient
|
||||
queue_name = workflow_input['queue_name']
|
||||
|
||||
execution = workflow_client.executions.create(
|
||||
execution = base.start_workflow(
|
||||
workflow_client,
|
||||
'tripleo.baremetal.v1.introspect',
|
||||
workflow_input={'node_uuids': workflow_input['node_uuids'],
|
||||
'queue_name': queue_name}
|
||||
@ -111,7 +117,8 @@ def introspect_manageable_nodes(clients, **workflow_input):
|
||||
tripleoclients = clients.tripleoclient
|
||||
queue_name = workflow_input['queue_name']
|
||||
|
||||
execution = workflow_client.executions.create(
|
||||
execution = base.start_workflow(
|
||||
workflow_client,
|
||||
'tripleo.baremetal.v1.introspect_manageable_nodes',
|
||||
workflow_input={"queue_name": queue_name, }
|
||||
)
|
||||
@ -159,7 +166,8 @@ def provide_manageable_nodes(clients, **workflow_input):
|
||||
tripleoclients = clients.tripleoclient
|
||||
queue_name = workflow_input['queue_name']
|
||||
|
||||
execution = workflow_client.executions.create(
|
||||
execution = base.start_workflow(
|
||||
workflow_client,
|
||||
'tripleo.baremetal.v1.provide_manageable_nodes',
|
||||
workflow_input={"queue_name": queue_name, }
|
||||
)
|
||||
|
@ -19,3 +19,16 @@ def call_action(workflow_client, action, **input_):
|
||||
|
||||
# Parse the JSON output. Mistral client should do this for us really.
|
||||
return json.loads(result.output)['result']
|
||||
|
||||
|
||||
def start_workflow(workflow_client, identifier, workflow_input):
|
||||
|
||||
execution = workflow_client.executions.create(
|
||||
identifier,
|
||||
workflow_input=workflow_input
|
||||
)
|
||||
|
||||
print("Started Mistral Workflow. Execution ID: {}".format(
|
||||
execution.id))
|
||||
|
||||
return execution
|
||||
|
@ -20,6 +20,8 @@ from heatclient.common import event_utils
|
||||
from tripleoclient import exceptions
|
||||
from tripleoclient import utils
|
||||
|
||||
from tripleoclient.workflows import base
|
||||
|
||||
|
||||
def deploy(clients, **workflow_input):
|
||||
|
||||
@ -27,7 +29,8 @@ def deploy(clients, **workflow_input):
|
||||
tripleoclients = clients.tripleoclient
|
||||
queue_name = workflow_input['queue_name']
|
||||
|
||||
execution = workflow_client.executions.create(
|
||||
execution = base.start_workflow(
|
||||
workflow_client,
|
||||
'tripleo.deployment.v1.deploy_plan',
|
||||
workflow_input=workflow_input
|
||||
)
|
||||
|
@ -32,7 +32,8 @@ def create_default_plan(clients, **workflow_input):
|
||||
tripleoclients = clients.tripleoclient
|
||||
queue_name = workflow_input['queue_name']
|
||||
|
||||
execution = workflow_client.executions.create(
|
||||
execution = base.start_workflow(
|
||||
workflow_client,
|
||||
'tripleo.plan_management.v1.create_default_deployment_plan',
|
||||
workflow_input=workflow_input
|
||||
)
|
||||
@ -53,8 +54,9 @@ def _create_update_deployment_plan(clients, workflow, **workflow_input):
|
||||
tripleoclients = clients.tripleoclient
|
||||
queue_name = workflow_input['queue_name']
|
||||
|
||||
execution = workflow_client.executions.create(
|
||||
workflow,
|
||||
execution = base.start_workflow(
|
||||
workflow_client,
|
||||
'tripleo.plan_management.v1.create_deployment_plan',
|
||||
workflow_input=workflow_input
|
||||
)
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user