From 1962b73c82f1782c52baaf30a74afbd1af523ad1 Mon Sep 17 00:00:00 2001 From: huangtianhua Date: Fri, 5 Dec 2014 15:16:19 +0800 Subject: [PATCH] Use template directly instead of stack.tmpl Use template.Template directly instead of stack.tmpl.Template. Change-Id: I856300b896a55bbd33cdc8b465a2bb4a43ea2b39 --- heat/engine/stack_resource.py | 4 ++-- heat/tests/test_engine_service.py | 4 ++-- heat/tests/test_stack_resource.py | 2 +- heat/tests/test_swiftsignal.py | 3 ++- 4 files changed, 7 insertions(+), 6 deletions(-) diff --git a/heat/engine/stack_resource.py b/heat/engine/stack_resource.py index 35aefdc9ff..9ed17c8ae9 100644 --- a/heat/engine/stack_resource.py +++ b/heat/engine/stack_resource.py @@ -125,8 +125,8 @@ class StackResource(resource.Resource): parsed_child_template = child_template if isinstance(parsed_child_template, template.Template): parsed_child_template = parsed_child_template.t - return parser.tmpl.Template(parsed_child_template, - files=self.stack.t.files) + return template.Template(parsed_child_template, + files=self.stack.t.files) def _parse_nested_stack(self, stack_name, child_template, child_params, timeout_mins=None, adopt_data=None): diff --git a/heat/tests/test_engine_service.py b/heat/tests/test_engine_service.py index f0b905083a..31c446baf0 100644 --- a/heat/tests/test_engine_service.py +++ b/heat/tests/test_engine_service.py @@ -211,7 +211,7 @@ def get_wordpress_stack(stack_name, ctx): def get_wordpress_stack_no_params(stack_name, ctx): t = template_format.parse(wp_template) - template = parser.tmpl.Template(t) + template = templatem.Template(t) stack = parser.Stack(ctx, stack_name, template, environment.Environment({})) return stack @@ -989,7 +989,7 @@ class StackServiceCreateUpdateDeleteTest(common.HeatTestCase): s = db_api.stack_get(self.ctx, sid) t = template_format.parse(wp_template_no_default) - template = parser.tmpl.Template(t) + template = templatem.Template(t) env = environment.Environment({'parameters': with_params, 'resource_registry': {'rsc': 'test'}}) stack = parser.Stack(self.ctx, stack_name, template, env) diff --git a/heat/tests/test_stack_resource.py b/heat/tests/test_stack_resource.py index 5f48805c36..875078012b 100644 --- a/heat/tests/test_stack_resource.py +++ b/heat/tests/test_stack_resource.py @@ -109,7 +109,7 @@ class StackResourceTest(common.HeatTestCase): resource._register_class('GenericResource', generic_rsrc.GenericResource) self.ws_resname = "provider_resource" - t = parser.tmpl.Template( + t = templatem.Template( {'HeatTemplateFormatVersion': '2012-12-12', 'Resources': {self.ws_resname: ws_res_snippet}}) self.parent_stack = parser.Stack(utils.dummy_context(), 'test_stack', diff --git a/heat/tests/test_swiftsignal.py b/heat/tests/test_swiftsignal.py index 9a36b05192..492c871515 100644 --- a/heat/tests/test_swiftsignal.py +++ b/heat/tests/test_swiftsignal.py @@ -30,6 +30,7 @@ from heat.engine import resource from heat.engine import rsrc_defn from heat.engine import scheduler from heat.engine import stack +from heat.engine import template as templatem from heat.tests import common from heat.tests import utils @@ -83,7 +84,7 @@ obj_header = { def create_stack(template, stack_id=None): tmpl = template_format.parse(template) - template = stack.tmpl.Template(tmpl) + template = templatem.Template(tmpl) ctx = utils.dummy_context(tenant_id='test_tenant') st = stack.Stack(ctx, 'test_st', template, environment.Environment(),