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:
parent
5ea79d62b3
commit
b46a4ad442
@ -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)):
|
||||
|
@ -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):
|
||||
|
Loading…
Reference in New Issue
Block a user