Pass mistral execution argument by name

A recent released change added a positional argument where we don't
expect it. It works around it.

Closes-Bug: #1749645
Change-Id: I4e9f4bb726c3461d17b2e22679377e262cd13462
This commit is contained in:
Thomas Herve 2018-02-16 10:24:22 +01:00
parent 3e51547f31
commit 7ec0a70b20
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)()