Let resources decide when to update

Previously, the StackUpdate code decided when an update was necessary for a
resource. However, all of the information required to make this decision is
available to the resource, so push this decision into the resource so that
it can implement custom behaviour if necessary.

Change-Id: If098424cf2502c02bad4194d509393d198d8745f
This commit is contained in:
Zane Bitter 2013-11-27 12:27:06 +01:00
parent 5ea79d62b3
commit b46a4ad442
2 changed files with 4 additions and 5 deletions

View File

@ -423,6 +423,8 @@ class Resource(object):
if before is None:
before = self.parsed_template()
elif before == after:
return
if (self.action, self.status) in ((self.CREATE, self.IN_PROGRESS),
(self.UPDATE, self.IN_PROGRESS)):

View File

@ -141,16 +141,13 @@ class StackUpdate(object):
yield self._create_resource(new_res)
@scheduler.wrappertask
def _update_in_place(self, existing_res, new_res):
# Compare resolved pre/post update resource snippets,
# note the new resource snippet is resolved in the context
# Note the new resource snippet is resolved in the context
# of the existing stack (which is the stack being updated)
existing_snippet = self.existing_snippets[existing_res.name]
new_snippet = self.existing_stack.resolve_runtime_data(new_res.t)
if new_snippet != existing_snippet:
yield existing_res.update(new_snippet, existing_snippet)
return existing_res.update(new_snippet, existing_snippet)
@scheduler.wrappertask
def _process_existing_resource_update(self, existing_res):