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
This commit is contained in:
parent
01187b30f9
commit
f80e5793f6
|
@ -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)
|
||||
|
||||
|
|
|
@ -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):
|
||||
|
|
Loading…
Reference in New Issue