From: Steve Baker Date: Wed, 12 Dec 2012 01:48:17 +0000 (+1300) Subject: Move resolved template comparison to stack update X-Git-Tag: 2014.1~1092 X-Git-Url: https://review.fuel-infra.org/gitweb?a=commitdiff_plain;h=310204c816c0b4e8aa619d63a38201bb3e03a0fc;p=openstack-build%2Fheat-build.git Move resolved template comparison to stack update This partially reverts the following commit https://review.openstack.org/#/c/17563/3 Resource comparison is now done as per Zane's last comment in that review. Change-Id: I1663d262b79603ab86bc5bdb4f2ee75e87c0075e --- diff --git a/heat/engine/parser.py b/heat/engine/parser.py index 8abb9cc9..de415d21 100644 --- a/heat/engine/parser.py +++ b/heat/engine/parser.py @@ -309,7 +309,9 @@ 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[res.name] != res: + if self.resolve_runtime_data( + self[res.name].t) != self.resolve_runtime_data(res.t): + # Can fail if underlying resource class does not # implement update logic or update requires replacement retval = self[res.name].update(res.parsed_template()) diff --git a/heat/engine/resource.py b/heat/engine/resource.py index fad416eb..c71602be 100644 --- a/heat/engine/resource.py +++ b/heat/engine/resource.py @@ -139,8 +139,7 @@ class Resource(object): # equal if their names and parsed_templates are the same if isinstance(other, Resource): return (self.name == other.name) and ( - self.parsed_template() == self.parsed_template( - template=other.t)) + self.parsed_template() == other.parsed_template()) return NotImplemented def __ne__(self, other): @@ -158,14 +157,14 @@ class Resource(object): return identifier.ResourceIdentifier(resource_name=self.name, **self.stack.identifier()) - def parsed_template(self, section=None, default={}, template=None): + def parsed_template(self, section=None, default={}): ''' Return the parsed template data for the resource. May be limited to only one section of the data, in which case a default value may also be supplied. ''' if section is None: - template = template or self.t + template = self.t else: template = self.t.get(section, default) return self.stack.resolve_runtime_data(template)