diff --git a/heat/engine/resource.py b/heat/engine/resource.py index 756b27c47d..622f8a9da7 100644 --- a/heat/engine/resource.py +++ b/heat/engine/resource.py @@ -1186,6 +1186,12 @@ class Resource(object): LOG.info(_LI('deleting %s'), six.text_type(self)) + if self._stored_properties_data is not None: + # On delete we can't rely on re-resolving the properties + # so use the stored frozen_definition instead + self.properties = self.frozen_definition().properties( + self.properties_schema, self.context) + with self._action_recorder(action): if self.abandon_in_progress: deletion_policy = self.t.RETAIN diff --git a/heat/tests/common.py b/heat/tests/common.py index 70cf48386b..c275afb95c 100644 --- a/heat/tests/common.py +++ b/heat/tests/common.py @@ -143,6 +143,8 @@ class HeatTestCase(testscenarios.WithScenarios, generic_rsrc.SignalResource) resource._register_class('ResourceWithPropsType', generic_rsrc.ResourceWithProps) + resource._register_class('ResourceWithPropsRefPropOnDelete', + generic_rsrc.ResourceWithPropsRefPropOnDelete) resource._register_class('StackUserResourceType', generic_rsrc.StackUserResource) resource._register_class('ResourceWithResourceIDType', diff --git a/heat/tests/generic_resource.py b/heat/tests/generic_resource.py index a22914eb04..2f6adf84b6 100644 --- a/heat/tests/generic_resource.py +++ b/heat/tests/generic_resource.py @@ -97,6 +97,11 @@ class ResourceWithProps(GenericResource): 'FooInt': properties.Schema(properties.Schema.INTEGER)} +class ResourceWithPropsRefPropOnDelete(ResourceWithProps): + def check_delete_complete(self, cookie): + return self.properties['FooInt'] is not None + + class ResourceWithPropsAndAttrs(ResourceWithProps): attributes_schema = {'Bar': attributes.Schema('Something.')} diff --git a/heat/tests/test_stack_update.py b/heat/tests/test_stack_update.py index a158c11057..8759e7ec2c 100644 --- a/heat/tests/test_stack_update.py +++ b/heat/tests/test_stack_update.py @@ -1695,13 +1695,15 @@ class StackUpdateTest(common.HeatTestCase): tmpl_update = { 'heat_template_version': '2013-05-23', + 'parameters': {'aparam': {'type': 'number', 'default': 1}}, 'resources': { 'Ares': {'type': 'GenericResourceType'}, 'Bres': {'type': 'GenericResourceType'}, 'Cres': { - 'type': 'ResourceWithPropsType', + 'type': 'ResourceWithPropsRefPropOnDelete', 'properties': { 'Foo': {'get_resource': 'Bres'}, + 'FooInt': {'get_param': 'aparam'}, } } }