summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorZane Bitter <zbitter@redhat.com>2014-08-26 18:37:09 -0400
committerZane Bitter <zbitter@redhat.com>2014-08-27 19:07:13 -0400
commitf80e5793f662c6c499f6afcd8880d18efba5c31f (patch)
tree0e7fd9cc6698ce13fb34fe9440ee691caf233378
parent01187b30f9925a8083553417b8fac7e6cfb46dcb (diff)
downloadheat-f80e5793f662c6c499f6afcd8880d18efba5c31f.tar.gz
Use ResourceDefinition as 'before' in resource updates
Replace the use of Resource.parsed_template() in updates with a frozen version of a ResourceDefinition that uses the property values stored in the database from the last update/create action, rather than calculated from the template. Change-Id: Id23ad60fbf98f2740ece2a337e795cfb3959d6f8 Implements: partial-blueprint update-failure-recovery
-rw-r--r--heat/engine/resource.py18
-rw-r--r--heat/engine/update.py2
2 files changed, 12 insertions, 8 deletions
diff --git a/heat/engine/resource.py b/heat/engine/resource.py
index b7c96bbdb..c7cde3852 100644
--- a/heat/engine/resource.py
+++ b/heat/engine/resource.py
@@ -297,6 +297,13 @@ class Resource(object):
template = self.t.get(section, default)
return function.resolve(template)
+ def frozen_definition(self):
+ if self._stored_properties_data is not None:
+ args = {'properties': self._stored_properties_data}
+ else:
+ args = {}
+ return self.t.freeze(**args)
+
def update_template_diff(self, after, before):
'''
Returns the difference between the before and after json snippets. If
@@ -631,7 +638,7 @@ class Resource(object):
if prev_ver != cur_ver:
return True
- if before != after:
+ if before != after.freeze():
return True
try:
@@ -650,13 +657,10 @@ class Resource(object):
assert isinstance(after, rsrc_defn.ResourceDefinition)
if before is None:
- before = self.parsed_template()
+ before = self.frozen_definition()
- before_props = Properties(self.properties_schema,
- before.get('Properties', {}),
- function.resolve,
- self.name,
- self.context)
+ before_props = before.properties(self.properties_schema,
+ self.context)
after_props = after.properties(self.properties_schema,
self.context)
diff --git a/heat/engine/update.py b/heat/engine/update.py
index 08afe83e4..41d6f02a1 100644
--- a/heat/engine/update.py
+++ b/heat/engine/update.py
@@ -37,7 +37,7 @@ class StackUpdate(object):
self.rollback = rollback
- self.existing_snippets = dict((n, r.parsed_template())
+ self.existing_snippets = dict((n, r.frozen_definition())
for n, r in self.existing_stack.items())
def __repr__(self):