]> review.fuel-infra Code Review - openstack-build/heat-build.git/commitdiff
heat engine : pass fully resolved template to update
authorSteven Hardy <shardy@redhat.com>
Tue, 29 Jan 2013 15:58:08 +0000 (15:58 +0000)
committerSteven Hardy <shardy@redhat.com>
Thu, 31 Jan 2013 10:28:46 +0000 (10:28 +0000)
We need to pass the fully resolved (static and runtime)
resource template into the resource update(), so the
resource can compare pre/post update templates properly

Change-Id: I2fba2fef9c9f9ccb9b7cde9bd24bd06af7659240
Signed-off-by: Steven Hardy <shardy@redhat.com>
heat/engine/parser.py

index 461e6c2e60a84dbd3c3d814a4f77b702259e8a57..9bc2b64243ad2ab93a0720a33b761e73e0519125 100644 (file)
@@ -313,12 +313,16 @@ class Stack(object):
                 # Currently all resource have a default handle_update method
                 # which returns "requires replacement" (res.UPDATE_REPLACE)
                 for res in newstack:
-                    if self.resolve_runtime_data(self[res.name].t) !=\
-                            self.resolve_runtime_data(res.t):
+                    # Compare resolved pre/post update resource snippets,
+                    # note the new resource snippet is resolved in the context
+                    # of the existing stack (which is the stack being updated)
+                    old_snippet = self.resolve_runtime_data(self[res.name].t)
+                    new_snippet = self.resolve_runtime_data(res.t)
+                    if old_snippet != new_snippet:
 
                         # Can fail if underlying resource class does not
                         # implement update logic or update requires replacement
-                        retval = self[res.name].update(res.parsed_template())
+                        retval = self[res.name].update(new_snippet)
                         if retval == self[res.name].UPDATE_REPLACE:
                             logger.info("Resource %s for stack %s" %
                                         (res.name, self.name) +