diff --git a/heat/engine/update.py b/heat/engine/update.py index 0e699de67..836a8c7a1 100644 --- a/heat/engine/update.py +++ b/heat/engine/update.py @@ -238,6 +238,11 @@ class StackUpdate(object): updated_props = updated_res.frozen_definition().properties( updated_res.properties_schema, updated_res.context) + # type comparison must match that in _process_new_resource_update + if type(current_res) is not type(updated_res): + replaced_keys.append(key) + continue + try: if current_res._needs_update(updated_res.frozen_definition(), current_res.frozen_definition(), diff --git a/heat/tests/engine/service/test_stack_update.py b/heat/tests/engine/service/test_stack_update.py index 5766bea0b..782d511df 100644 --- a/heat/tests/engine/service/test_stack_update.py +++ b/heat/tests/engine/service/test_stack_update.py @@ -786,6 +786,19 @@ resources: section_contents = [x for x in result[section]] self.assertEqual([], section_contents) + def test_stack_update_preview_replaced_type(self): + # new template with a different type for web_server + new_tmpl = self.old_tmpl.replace('OS::Nova::Server', 'OS::Heat::None') + + result = self._test_stack_update_preview(self.old_tmpl, new_tmpl) + + replaced = [x for x in result['replaced']][0] + self.assertEqual('web_server', replaced['resource_name']) + empty_sections = ('added', 'deleted', 'unchanged', 'updated') + for section in empty_sections: + section_contents = [x for x in result[section]] + self.assertEqual([], section_contents) + def test_stack_update_preview_updated(self): # new template changes to flavor of server new_tmpl = self.old_tmpl.replace('m1.large', 'm1.small')