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 686f317cca
)
This commit is contained in:
parent
6e54b343b0
commit
e62752f4b9
|
@ -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())
|
||||
|
|
Loading…
Reference in New Issue