diff options
author | Jenkins <jenkins@review.openstack.org> | 2015-04-07 04:56:49 +0000 |
---|---|---|
committer | Gerrit Code Review <review@openstack.org> | 2015-04-07 04:56:49 +0000 |
commit | d56778dc7a92960199be47242a82716367f4ffe9 (patch) | |
tree | 06b02e3aeeee6adb5c8b7901dc7979e7db40ffa9 | |
parent | 7a6e5f4914a139647d3203eee6fd6f1f7df9dbb0 (diff) | |
parent | 189324a7094dc84d8b8206df38e754ae07daf1e4 (diff) | |
download | heat-d56778dc7a92960199be47242a82716367f4ffe9.tar.gz |
Merge "Fix stack update issue"2015.1.0rc1proposed/kilo
-rw-r--r-- | heat/engine/update.py | 4 | ||||
-rw-r--r-- | heat/tests/test_stack_update.py | 26 |
2 files changed, 29 insertions, 1 deletions
diff --git a/heat/engine/update.py b/heat/engine/update.py index 4683223ca..67d4fda83 100644 --- a/heat/engine/update.py +++ b/heat/engine/update.py @@ -124,8 +124,10 @@ class StackUpdate(object): @scheduler.wrappertask def _process_new_resource_update(self, new_res): res_name = new_res.name + res_type = new_res.type() - if res_name in self.existing_stack: + if (res_name in self.existing_stack and + res_type == self.existing_stack[res_name].type()): existing_res = self.existing_stack[res_name] try: yield self._update_in_place(existing_res, diff --git a/heat/tests/test_stack_update.py b/heat/tests/test_stack_update.py index 4867979d8..7be51c9c5 100644 --- a/heat/tests/test_stack_update.py +++ b/heat/tests/test_stack_update.py @@ -89,6 +89,32 @@ class StackUpdateTest(common.HeatTestCase): self.stack.state) self.assertNotIn('BResource', self.stack) + def test_update_different_type(self): + tmpl = {'HeatTemplateFormatVersion': '2012-12-12', + 'Resources': { + 'AResource': {'Type': 'GenericResourceType'}}} + + self.stack = stack.Stack(self.ctx, 'update_test_stack', + template.Template(tmpl)) + self.stack.store() + self.stack.create() + self.assertEqual((stack.Stack.CREATE, stack.Stack.COMPLETE), + self.stack.state) + self.assertEqual('GenericResourceType', + self.stack['AResource'].type()) + + tmpl2 = {'HeatTemplateFormatVersion': '2012-12-12', + 'Resources': {'AResource': {'Type': 'ResourceWithPropsType', + 'Properties': {'Foo': 'abc'}}}} + + updated_stack = stack.Stack(self.ctx, 'updated_stack', + template.Template(tmpl2)) + self.stack.update(updated_stack) + self.assertEqual((stack.Stack.UPDATE, stack.Stack.COMPLETE), + self.stack.state) + self.assertEqual('ResourceWithPropsType', + self.stack['AResource'].type()) + def test_update_description(self): tmpl = {'HeatTemplateFormatVersion': '2012-12-12', 'Description': 'ATemplate', |