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:
Dougal Matthews 2016-10-04 13:13:42 +01:00
parent cf799762c5
commit bb72623e8c
4 changed files with 15 additions and 7 deletions

View File

@ -61,7 +61,8 @@ class TestSetParameters(utils.TestCommand):
{
'container': 'overcast',
'parameters': data.get('parameter_defaults', data)
})
},
run_sync=True, save_result=True)
def test_json_params_file(self):
self._test_set_parameters(".json", json.dumps, {

View File

@ -183,7 +183,8 @@ class TestOvercloudCreatePlan(utils.TestCommand):
# Verify
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(
@ -216,7 +217,8 @@ class TestOvercloudCreatePlan(utils.TestCommand):
# Verify
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(

View File

@ -52,7 +52,8 @@ class TestPlanCreationWorkflows(utils.TestCommand):
self.workflow.action_executions.create.assert_called_once_with(
'tripleo.plan.create_container',
{'container': 'test-overcloud'})
{'container': 'test-overcloud'},
run_sync=True, save_result=True)
self.workflow.executions.create.assert_called_once_with(
'tripleo.plan_management.v1.create_deployment_plan',
@ -74,7 +75,8 @@ class TestPlanCreationWorkflows(utils.TestCommand):
self.workflow.action_executions.create.assert_called_once_with(
'tripleo.plan.create_container',
{'container': 'test-overcloud'})
{'container': 'test-overcloud'},
run_sync=True, save_result=True)
self.workflow.executions.create.assert_not_called()
@ -97,7 +99,8 @@ class TestPlanCreationWorkflows(utils.TestCommand):
self.workflow.action_executions.create.assert_called_once_with(
'tripleo.plan.create_container',
{'container': 'test-overcloud'})
{'container': 'test-overcloud'},
run_sync=True, save_result=True)
self.workflow.executions.create.assert_called_once_with(
'tripleo.plan_management.v1.create_deployment_plan',

View File

@ -15,7 +15,9 @@ import json
def call_action(workflow_client, action, **input_):
"""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.
return json.loads(result.output)['result']