Merge "Pass mistral execution argument by name"

This commit is contained in:
Zuul 2018-02-16 18:00:14 +00:00 committed by Gerrit Code Review
commit 2d2756c882
3 changed files with 7 additions and 7 deletions

View File

@ -188,8 +188,8 @@ class MistralExternalResource(resource.Resource):
inputs = self.properties[self.INPUT]
execution = self.client().executions.create(
action_data[self.WORKFLOW],
jsonutils.dumps(inputs),
self.properties[self.DESCRIPTION],
workflow_input=jsonutils.dumps(inputs),
description=self.properties[self.DESCRIPTION],
**action_data[self.PARAMS])
LOG.debug('Mistral execution %(id)s params set to '
'%(params)s' % {'id': execution.id,

View File

@ -587,7 +587,7 @@ class Workflow(signal_responder.SignalResponder,
try:
execution = self.client().executions.create(
self._workflow_name(),
jsonutils.dumps(inputs_result),
workflow_input=jsonutils.dumps(inputs_result),
**params_result)
except Exception as ex:
raise exception.ResourceFailure(ex, self)

View File

@ -687,11 +687,11 @@ class TestMistralWorkflow(common.HeatTestCase):
self.patchobject(exec_manager, '_create', return_value=execution)
scheduler.TaskRunner(wf.signal, details)()
call_args = self.mistral.executions.create.call_args
args, _ = call_args
args, kwargs = call_args
expected_args = (
'{"image": "31d8eeaf-686e-4e95-bb27-765014b9f20b", '
'"name": "create_test_server", "flavor": "3"}')
self.validate_json_inputs(args[1], expected_args)
self.validate_json_inputs(kwargs['workflow_input'], expected_args)
self.assertEqual({'executions': '12345'}, wf.data())
# Updating the workflow changing "use_request_body_as_input" to
# false and signaling again with the expected request body format.
@ -712,11 +712,11 @@ class TestMistralWorkflow(common.HeatTestCase):
self.patchobject(exec_manager, '_create', return_value=execution)
scheduler.TaskRunner(wf.signal, details)()
call_args = self.mistral.executions.create.call_args
args, _ = call_args
args, kwargs = call_args
expected_args = (
'{"image": "31d8eeaf-686e-4e95-bb27-765014b9f20b", '
'"name": "create_test_server", "flavor": "4"}')
self.validate_json_inputs(args[1], expected_args)
self.validate_json_inputs(kwargs['workflow_input'], expected_args)
self.assertEqual({'executions': '54321,12345', 'name':
'test_stack-workflow-b5fiekdsa355'}, wf.data())
scheduler.TaskRunner(wf.delete)()