Always replace DELETE_COMPLETE resources on update

Previously, this only happened in convergence, presumably because it was
assumed that the condition could only show up in convergence. However, even
in the legacy path there exists a brief window between when the Resource is
marked DELETE_COMPLETE and when it is destroyed (removed from the DB). An
exception at that exact point could leave a resource in this state. There's
also people manually fiddling around in the database to contend with.

If a resource is DELETE_COMPLETE then there is no possible way for an
update to do anything sensible with it; we always want to create a
replacement if it still exists in the template.

Closes-Bug: #1717837
Change-Id: Ic750f631399084441af95fd1835a136c2c7dc4b4
(cherry picked from commit 0549ee2bb0)
This commit is contained in:
Zane Bitter 2017-01-20 11:17:58 -05:00 committed by rabi
parent 6842619286
commit 3b32b44d87
1 changed files with 2 additions and 2 deletions

View File

@ -1093,8 +1093,8 @@ class Resource(object):
def _needs_update(self, after, before, after_props, before_props,
prev_resource, check_init_complete=True):
if self.status == self.FAILED or (self.stack.convergence and (
self.action, self.status) == (self.DELETE, self.COMPLETE)):
if (self.status == self.FAILED or
self.state == (self.DELETE, self.COMPLETE)):
raise UpdateReplace(self)
if check_init_complete and (self.action == self.INIT