Only reset current resource's attrs in state_set
There is no need to reset other resources' attributes in the stack when a resource calls state_set(), the other resources attributes will get updated as they are visited. This is not a huge performance gain since those resources would have been in memory anyway, but let's not use the big hammer if we don't have to. Change-Id: Icafd770055a3dc2f1f3262753a8dca045e38972d
This commit is contained in:
parent
45ae709e75
commit
00c886c8b0
|
@ -2014,7 +2014,7 @@ class Resource(object):
|
||||||
if new_state != old_state:
|
if new_state != old_state:
|
||||||
self._add_event(action, status, reason)
|
self._add_event(action, status, reason)
|
||||||
|
|
||||||
self.stack.reset_resource_attributes()
|
self.attributes.reset_resolved_values()
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def state(self):
|
def state(self):
|
||||||
|
|
|
@ -2007,15 +2007,6 @@ class Stack(collections.Mapping):
|
||||||
'tags': self.tags,
|
'tags': self.tags,
|
||||||
}
|
}
|
||||||
|
|
||||||
def reset_resource_attributes(self):
|
|
||||||
# nothing is cached if no resources exist
|
|
||||||
if not self._resources:
|
|
||||||
return
|
|
||||||
# a change in some resource may have side-effects in the attributes
|
|
||||||
# of other resources, so ensure that attributes are re-calculated
|
|
||||||
for res in six.itervalues(self.resources):
|
|
||||||
res.attributes.reset_resolved_values()
|
|
||||||
|
|
||||||
def has_cache_data(self, resource_name):
|
def has_cache_data(self, resource_name):
|
||||||
return (self.cache_data is not None and
|
return (self.cache_data is not None and
|
||||||
self.cache_data.get(resource_name) is not None)
|
self.cache_data.get(resource_name) is not None)
|
||||||
|
|
Loading…
Reference in New Issue