Merge "Always replace a failed resource on rollback"

This commit is contained in:
Jenkins 2014-08-28 21:19:38 +00:00 committed by Gerrit Code Review
commit 99a11f8633
2 changed files with 7 additions and 0 deletions

View File

@ -622,6 +622,9 @@ class Resource(object):
def _needs_update(self, after, before, after_props, before_props,
prev_resource):
if self.status == self.FAILED:
raise UpdateReplace(self)
if prev_resource is not None:
cur_class_def, cur_ver = self.implementation_signature()
prev_class_def, prev_ver = prev_resource.implementation_signature()

View File

@ -2711,8 +2711,12 @@ class StackTest(HeatTestCase):
disable_rollback=False)
# patch in a dummy delete making the destroy fail
self.m.StubOutWithMock(generic_rsrc.ResourceWithProps, 'handle_create')
self.m.StubOutWithMock(generic_rsrc.ResourceWithProps, 'handle_delete')
generic_rsrc.ResourceWithProps.handle_delete().AndRaise(Exception)
# replace the failed resource on rollback
generic_rsrc.ResourceWithProps.handle_create()
generic_rsrc.ResourceWithProps.handle_delete()
self.m.ReplayAll()
self.stack.update(updated_stack)