Fix getting action_spec in create tasks
* In https://review.openstack.org/#/c/96708 we miss the moment when we see action_spec in namespace of our workbook. Actions of predefined namespaces (e.g std) is not a part of workbook namespaces and they aren't seen in it. Change-Id: Ifa2eb391b4a747ec1ec3dceb22a0a29ae1d781c1
This commit is contained in:
parent
bae23a45b0
commit
db743123e5
17
mistral/tests/resources/control_flow/one_std_task.yaml
Normal file
17
mistral/tests/resources/control_flow/one_std_task.yaml
Normal file
@ -0,0 +1,17 @@
|
||||
Namespaces:
|
||||
Nova:
|
||||
actions:
|
||||
create-vm:
|
||||
class: std.http
|
||||
base-parameters:
|
||||
url: http://path_to_nova/url_for_create
|
||||
output:
|
||||
vm_id: $.base_output.server_id
|
||||
|
||||
Workflow:
|
||||
tasks:
|
||||
std_http_task:
|
||||
action: std.http
|
||||
parameters:
|
||||
method: GET
|
||||
url: http://some_url
|
@ -278,3 +278,21 @@ class TestEngine(base.EngineTestCase):
|
||||
self.assertEqual(1, len(tasks))
|
||||
self.assertEqual(tasks[0]['state'], states.SUCCESS)
|
||||
self.assertEqual(execution['state'], states.SUCCESS)
|
||||
|
||||
@mock.patch.object(
|
||||
db_api, 'workbook_get',
|
||||
mock.MagicMock(return_value={'definition': base.get_resource(
|
||||
'control_flow/one_std_task.yaml')}))
|
||||
@mock.patch.object(
|
||||
concrete_engine.DefaultEngine, '_run_tasks',
|
||||
mock.MagicMock(side_effect=base.EngineTestCase.mock_run_tasks))
|
||||
def test_engine_task_std_action_with_namespaces(self):
|
||||
execution = self.engine.start_workflow_execution(WB_NAME,
|
||||
"std_http_task", {})
|
||||
|
||||
tasks = db_api.tasks_get(WB_NAME, execution['id'])
|
||||
execution = db_api.execution_get(WB_NAME, execution['id'])
|
||||
|
||||
self.assertEqual(1, len(tasks))
|
||||
self.assertEqual(states.SUCCESS, tasks[0]['state'])
|
||||
self.assertEqual(states.SUCCESS, execution['state'])
|
||||
|
@ -56,8 +56,8 @@ class WorkbookSpec(base.BaseSpec):
|
||||
ns_name = full_action_name.split('.')[0]
|
||||
action_name = full_action_name.split('.')[1]
|
||||
|
||||
if self.namespaces:
|
||||
return self.namespaces.get(ns_name).actions.get(action_name)
|
||||
if ns_name in self.namespaces:
|
||||
return self.namespaces[ns_name].actions.get(action_name)
|
||||
|
||||
def get_actions(self, namespace_name):
|
||||
return self.namespaces.get(namespace_name).actions
|
||||
|
Loading…
Reference in New Issue
Block a user