diff --git a/heat/engine/worker.py b/heat/engine/worker.py index 2c9b1947a..1103d2006 100644 --- a/heat/engine/worker.py +++ b/heat/engine/worker.py @@ -303,7 +303,12 @@ def check_resource_update(rsrc, template_id, data, engine_id): ''' Create or update the Resource if appropriate. ''' - if rsrc.resource_id is None: + if (rsrc.resource_id is None + and not (rsrc.action == resource.Resource.CREATE and + rsrc.status in [ + resource.Resource.COMPLETE, + resource.Resource.FAILED + ])): rsrc.create_convergence(template_id, data, engine_id) else: rsrc.update_convergence(template_id, data, engine_id) diff --git a/heat/tests/test_engine_worker.py b/heat/tests/test_engine_worker.py index 1cb822792..de0f48c5b 100644 --- a/heat/tests/test_engine_worker.py +++ b/heat/tests/test_engine_worker.py @@ -469,6 +469,22 @@ class MiscMethodsTest(common.HeatTestCase): {}, 'engine-id') self.assertTrue(mock_update.called) + @mock.patch.object(resource.Resource, 'update_convergence') + def test_check_resource_update_complete(self, mock_update): + self.resource.action = 'CREATE' + self.resource.status = 'COMPLETE' + worker.check_resource_update(self.resource, self.resource.stack.t.id, + {}, 'engine-id') + self.assertTrue(mock_update.called) + + @mock.patch.object(resource.Resource, 'update_convergence') + def test_check_resource_update_failed(self, mock_update): + self.resource.action = 'CREATE' + self.resource.status = 'FAILED' + worker.check_resource_update(self.resource, self.resource.stack.t.id, + {}, 'engine-id') + self.assertTrue(mock_update.called) + @mock.patch.object(resource.Resource, 'delete_convergence') def test_check_resource_cleanup_delete(self, mock_delete): self.resource.current_template_id = 'new-template-id'