Save the result of direct action calls in Mistral
Mistral now allows us to run actions synchronously and have the result be saved. This is useful for audit purposes as direct action calls will now show up in `mistal action-execution-list`. Closes-Bug: #1631281 Depends-On: I00c6301394512e123436ca6c5650827c2475308e Change-Id: I4d5167d5fea5e75ae7246d1e92537489fc9a6f1e
This commit is contained in:
parent
cf799762c5
commit
bb72623e8c
|
@ -61,7 +61,8 @@ class TestSetParameters(utils.TestCommand):
|
||||||
{
|
{
|
||||||
'container': 'overcast',
|
'container': 'overcast',
|
||||||
'parameters': data.get('parameter_defaults', data)
|
'parameters': data.get('parameter_defaults', data)
|
||||||
})
|
},
|
||||||
|
run_sync=True, save_result=True)
|
||||||
|
|
||||||
def test_json_params_file(self):
|
def test_json_params_file(self):
|
||||||
self._test_set_parameters(".json", json.dumps, {
|
self._test_set_parameters(".json", json.dumps, {
|
||||||
|
|
|
@ -183,7 +183,8 @@ class TestOvercloudCreatePlan(utils.TestCommand):
|
||||||
|
|
||||||
# Verify
|
# Verify
|
||||||
self.workflow.action_executions.create.assert_called_once_with(
|
self.workflow.action_executions.create.assert_called_once_with(
|
||||||
'tripleo.plan.create_container', {"container": "overcast"}
|
'tripleo.plan.create_container', {"container": "overcast"},
|
||||||
|
run_sync=True, save_result=True
|
||||||
)
|
)
|
||||||
|
|
||||||
self.workflow.executions.create.assert_called_once_with(
|
self.workflow.executions.create.assert_called_once_with(
|
||||||
|
@ -216,7 +217,8 @@ class TestOvercloudCreatePlan(utils.TestCommand):
|
||||||
|
|
||||||
# Verify
|
# Verify
|
||||||
self.workflow.action_executions.create.assert_called_once_with(
|
self.workflow.action_executions.create.assert_called_once_with(
|
||||||
'tripleo.plan.create_container', {"container": "overcast"}
|
'tripleo.plan.create_container', {"container": "overcast"},
|
||||||
|
run_sync=True, save_result=True
|
||||||
)
|
)
|
||||||
|
|
||||||
self.workflow.executions.create.assert_called_once_with(
|
self.workflow.executions.create.assert_called_once_with(
|
||||||
|
|
|
@ -52,7 +52,8 @@ class TestPlanCreationWorkflows(utils.TestCommand):
|
||||||
|
|
||||||
self.workflow.action_executions.create.assert_called_once_with(
|
self.workflow.action_executions.create.assert_called_once_with(
|
||||||
'tripleo.plan.create_container',
|
'tripleo.plan.create_container',
|
||||||
{'container': 'test-overcloud'})
|
{'container': 'test-overcloud'},
|
||||||
|
run_sync=True, save_result=True)
|
||||||
|
|
||||||
self.workflow.executions.create.assert_called_once_with(
|
self.workflow.executions.create.assert_called_once_with(
|
||||||
'tripleo.plan_management.v1.create_deployment_plan',
|
'tripleo.plan_management.v1.create_deployment_plan',
|
||||||
|
@ -74,7 +75,8 @@ class TestPlanCreationWorkflows(utils.TestCommand):
|
||||||
|
|
||||||
self.workflow.action_executions.create.assert_called_once_with(
|
self.workflow.action_executions.create.assert_called_once_with(
|
||||||
'tripleo.plan.create_container',
|
'tripleo.plan.create_container',
|
||||||
{'container': 'test-overcloud'})
|
{'container': 'test-overcloud'},
|
||||||
|
run_sync=True, save_result=True)
|
||||||
|
|
||||||
self.workflow.executions.create.assert_not_called()
|
self.workflow.executions.create.assert_not_called()
|
||||||
|
|
||||||
|
@ -97,7 +99,8 @@ class TestPlanCreationWorkflows(utils.TestCommand):
|
||||||
|
|
||||||
self.workflow.action_executions.create.assert_called_once_with(
|
self.workflow.action_executions.create.assert_called_once_with(
|
||||||
'tripleo.plan.create_container',
|
'tripleo.plan.create_container',
|
||||||
{'container': 'test-overcloud'})
|
{'container': 'test-overcloud'},
|
||||||
|
run_sync=True, save_result=True)
|
||||||
|
|
||||||
self.workflow.executions.create.assert_called_once_with(
|
self.workflow.executions.create.assert_called_once_with(
|
||||||
'tripleo.plan_management.v1.create_deployment_plan',
|
'tripleo.plan_management.v1.create_deployment_plan',
|
||||||
|
|
|
@ -15,7 +15,9 @@ import json
|
||||||
def call_action(workflow_client, action, **input_):
|
def call_action(workflow_client, action, **input_):
|
||||||
"""Trigger a Mistral action and parse the JSON response"""
|
"""Trigger a Mistral action and parse the JSON response"""
|
||||||
|
|
||||||
result = workflow_client.action_executions.create(action, input_)
|
result = workflow_client.action_executions.create(
|
||||||
|
action, input_,
|
||||||
|
save_result=True, run_sync=True)
|
||||||
|
|
||||||
# Parse the JSON output. Mistral client should do this for us really.
|
# Parse the JSON output. Mistral client should do this for us really.
|
||||||
return json.loads(result.output)['result']
|
return json.loads(result.output)['result']
|
||||||
|
|
Loading…
Reference in New Issue