Use stored value in OS::Heat::Value resource
Currently when getting the 'value' attribute of an OS::Heat::Value resource, we recalculate the value from the properties - which means re-resolving any functions, including get_attr and the like. That's expensive and opens the possibility that the value can change over time, which is probably not what users would expect. Use the property values stored in the database at the time the resource was created or last updated instead. Change-Id: If0f80cab94c28514d1569b1025362ab9d9d31512 Closes-Bug: #1661728
This commit is contained in:
parent
58dd39d6f8
commit
b0506c933c
|
@ -65,8 +65,10 @@ class Value(resource.Resource):
|
|||
}
|
||||
|
||||
def _resolve_attribute(self, name):
|
||||
props = self.frozen_definition().properties(self.properties_schema,
|
||||
self.context)
|
||||
if name == self.VALUE_ATTR:
|
||||
return self.properties[self.VALUE]
|
||||
return props[self.VALUE]
|
||||
|
||||
def handle_create(self):
|
||||
self.resource_id_set(self.physical_resource_name())
|
||||
|
@ -76,9 +78,9 @@ class Value(resource.Resource):
|
|||
# the resource properties are updated appropriately in parent class.
|
||||
pass
|
||||
|
||||
def __init__(self, name, definition, stack):
|
||||
super(Value, self).__init__(name, definition, stack)
|
||||
value_type = self.properties.get(self.TYPE)
|
||||
def reparse(self, *args, **kwargs):
|
||||
super(Value, self).reparse(*args, **kwargs)
|
||||
value_type = self.properties[self.TYPE]
|
||||
if value_type is None:
|
||||
# We don't know what type the value is, anything goes
|
||||
return
|
||||
|
|
Loading…
Reference in New Issue