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
This commit is contained in:
@@ -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())
|
||||
|
||||
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user