diff --git a/heat/engine/stack_resource.py b/heat/engine/stack_resource.py index 5563fe66d..760b6cb2e 100644 --- a/heat/engine/stack_resource.py +++ b/heat/engine/stack_resource.py @@ -151,7 +151,12 @@ class StackResource(resource.Resource): msg = _("Recursion depth exceeds %d.") % \ cfg.CONF.max_nested_stack_depth raise exception.RequestLimitExceeded(message=msg) - template = parser.Template(child_template, files=self.stack.t.files) + if isinstance(child_template, parser.Template): + template = child_template + template.files = self.stack.t.files + else: + template = parser.Template(child_template, + files=self.stack.t.files) self._validate_nested_resources(template) self._outputs_to_attribs(template) @@ -195,7 +200,12 @@ class StackResource(resource.Resource): def update_with_template(self, child_template, user_params, timeout_mins=None): """Update the nested stack with the new template.""" - template = parser.Template(child_template, files=self.stack.t.files) + if isinstance(child_template, parser.Template): + template = child_template + template.files = self.stack.t.files + else: + template = parser.Template(child_template, + files=self.stack.t.files) nested_stack = self.nested() if nested_stack is None: raise exception.Error(_('Cannot update %s, stack not created') diff --git a/heat/tests/test_stack_resource.py b/heat/tests/test_stack_resource.py index cc6647127..e260c8672 100644 --- a/heat/tests/test_stack_resource.py +++ b/heat/tests/test_stack_resource.py @@ -492,9 +492,6 @@ class StackResourceTest(HeatTestCase): disable_rollback=True, parent_resource=self.parent_resource) - self.m.StubOutWithMock(parser, 'Template') - parser.Template(self.templ, files={}).AndReturn(templ) - self.m.StubOutWithMock(environment, 'Environment') environment.Environment().AndReturn(env)