Use action in check_*_complete method

Previously action paramater was used only for checking DELETE state,
when resource can not be found. This patch add condition for other
states. F.e. when nested resource was in INIT_COMPLETE state, we should
make sure, that state was changed to CREATE_* state.

(cherry-picked from f8f5a94517)
Change-Id: Ia5c429716f43b6cc8b7155fbf1ddc0c0a9369727
Related-Bug: #1433340
This commit is contained in:
Sergey Kraynev 2015-05-05 10:54:40 -04:00 committed by Steve Baker
parent 7bfe307323
commit 9ca4a533d5
2 changed files with 11 additions and 0 deletions

View File

@ -301,6 +301,9 @@ class StackResource(resource.Resource):
if nested is None:
return True
if nested.action != action:
return False
# Has the action really started?
#
# The rpc call to update does not guarantee that the stack will be

View File

@ -753,3 +753,11 @@ class StackResourceCheckCompleteTest(common.HeatTestCase):
self.assertFalse(complete(None))
self.parent_resource.nested.assert_called_once_with(
show_deleted=self.show_deleted, force_reload=True)
def test_wrong_action(self):
self.nested.action = 'COMPLETE'
complete = getattr(self.parent_resource,
'check_%s_complete' % self.action)
self.assertFalse(complete(None))
self.parent_resource.nested.assert_called_once_with(
show_deleted=self.show_deleted, force_reload=True)