diff options
author | Zane Bitter <zbitter@redhat.com> | 2015-05-06 21:29:25 -0400 |
---|---|---|
committer | Crag Wolfe <cwolfe@redhat.com> | 2015-11-11 18:36:45 -0500 |
commit | e62752f4b9cd6ffd116bfb6edbaefeb35958c2fa (patch) | |
tree | 0dd2d291a8d3a43d005dc39f2857ac2d0a6f64e5 | |
parent | 6e54b343b03bfd1549a51ddc358fbe004f45edcf (diff) | |
download | heat-e62752f4b9cd6ffd116bfb6edbaefeb35958c2fa.tar.gz |
Update template paths for environment-mapped TemplateResources
When updating a template resource, we weren't taking into account the
possibility that the new environment could be mapping the resource to a
different template path. This change ensures we recalculate the template
name from the new environment before reloading the template during an
update.
Change-Id: I5f84f6fd60925d3dba0b8e8dec867657c8c5c9ef
Closes-Bug: #1452534
(cherry picked from commit 686f317ccae280bd8b536379e89ba743746ae159)
-rw-r--r-- | heat/engine/resources/template_resource.py | 23 |
1 files changed, 14 insertions, 9 deletions
diff --git a/heat/engine/resources/template_resource.py b/heat/engine/resources/template_resource.py index 2543a17fc..d3e50d8f9 100644 --- a/heat/engine/resources/template_resource.py +++ b/heat/engine/resources/template_resource.py @@ -56,8 +56,19 @@ class TemplateResource(stack_resource.StackResource): self.stack = stack self.validation_exception = None - tri = stack.env.get_resource_info( - json_snippet['Type'], + 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) + 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['Type'], registry_type=environment.TemplateResourceInfo) if tri is None: self.validation_exception = ValueError(_( @@ -71,13 +82,6 @@ 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) - if self.validation_exception is None: - self._generate_schema(self.t) - def _generate_schema(self, definition): self._parsed_nested = None try: @@ -256,6 +260,7 @@ class TemplateResource(stack_resource.StackResource): self.child_params()) 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()) |