diff --git a/heat/engine/resources/template_resource.py b/heat/engine/resources/template_resource.py index 11c0904583..d3b9134692 100644 --- a/heat/engine/resources/template_resource.py +++ b/heat/engine/resources/template_resource.py @@ -50,9 +50,21 @@ class TemplateResource(stack_resource.StackResource): self.stack = stack self.validation_exception = None - tri = stack.env.get_resource_info( - json_snippet['Type'], - resource_name=name, + tri = self._get_resource_info(json_snippet) + + self.properties_schema = {} + self.attributes_schema = {} + + # run Resource.__init__() so we can call self.nested() + super(TemplateResource, self).__init__(name, json_snippet, stack) + self.resource_info = tri + if self.validation_exception is None: + self._generate_schema(self.t) + + def _get_resource_info(self, rsrc_defn): + tri = self.stack.env.get_resource_info( + rsrc_defn.resource_type, + resource_name=rsrc_defn.name, registry_type=environment.TemplateResourceInfo) if tri is None: self.validation_exception = ValueError(_( @@ -66,13 +78,7 @@ class TemplateResource(stack_resource.StackResource): else: self.allowed_schemes = ('http', 'https', 'file') - # run Resource.__init__() so we can call self.nested() - self.properties_schema = {} - self.attributes_schema = {} - super(TemplateResource, self).__init__(name, json_snippet, stack) - self.resource_info = tri - if self.validation_exception is None: - self._generate_schema(self.t) + return tri @staticmethod def get_template_file(template_name, allowed_schemes): @@ -261,6 +267,7 @@ class TemplateResource(stack_resource.StackResource): self.metadata_set(self.t.metadata()) def handle_update(self, json_snippet, tmpl_diff, prop_diff): + self._get_resource_info(json_snippet) self._generate_schema(json_snippet) return self.update_with_template(self.child_template(), self.child_params())