summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorZane Bitter <zbitter@redhat.com>2016-09-21 18:37:04 -0400
committerZane Bitter <zbitter@redhat.com>2016-09-22 10:06:43 -0400
commitadae45d76268eb57bf94600a404aa56d9769ca9c (patch)
treeae0e255c3978197e51adbca731754d970467f819
parented46562157d2f9983f5665394ec47d2e27aad0df (diff)
downloadheat-adae45d76268eb57bf94600a404aa56d9769ca9c.tar.gz
Don't use cast() to do StackResource delete
If an exception was raised in delete_stack when deleting a nested stack, the parent stack would never hear about it because we were accidentally using cast() instead of call() to do the stack delete. This meant the parent resource would remain DELETE_IN_PROGRESS until timeout when the nested stack had already failed and raised an exception. In the case of bug 1499669, the exception being missed was StopActionFailed. Change-Id: I039eb8f6c6a262653c1e9edc8173e5680d81e31b Partial-Bug: #1499669 (cherry picked from commit e5cec71e52c3fed0ffb4385990758db8ebf367da)
-rw-r--r--heat/engine/resources/stack_resource.py5
-rw-r--r--heat/tests/test_nested_stack.py2
-rw-r--r--heat/tests/test_provider_template.py3
-rw-r--r--heat/tests/test_stack_resource.py2
4 files changed, 7 insertions, 5 deletions
diff --git a/heat/engine/resources/stack_resource.py b/heat/engine/resources/stack_resource.py
index 0ce622454..ca79b45bc 100644
--- a/heat/engine/resources/stack_resource.py
+++ b/heat/engine/resources/stack_resource.py
@@ -454,9 +454,10 @@ class StackResource(resource.Resource):
if self.abandon_in_progress:
self.rpc_client().abandon_stack(self.context, stack_identity)
else:
- self.rpc_client().delete_stack(self.context, stack_identity)
+ self.rpc_client().delete_stack(self.context, stack_identity,
+ cast=False)
except Exception as ex:
- self.rpc_client().ignore_error_named(ex, 'NotFound')
+ self.rpc_client().ignore_error_named(ex, 'EntityNotFound')
def handle_delete(self):
return self.delete_nested()
diff --git a/heat/tests/test_nested_stack.py b/heat/tests/test_nested_stack.py
index 77d5d4081..24c8eaf12 100644
--- a/heat/tests/test_nested_stack.py
+++ b/heat/tests/test_nested_stack.py
@@ -413,4 +413,4 @@ Outputs:
self.res.nested().identifier.return_value = stack_identity
self.res.handle_delete()
self.res.rpc_client.return_value.delete_stack.assert_called_once_with(
- self.ctx, self.res.nested().identifier())
+ self.ctx, self.res.nested().identifier(), cast=False)
diff --git a/heat/tests/test_provider_template.py b/heat/tests/test_provider_template.py
index 7e48f341c..6148681c6 100644
--- a/heat/tests/test_provider_template.py
+++ b/heat/tests/test_provider_template.py
@@ -1021,4 +1021,5 @@ class TemplateResourceCrudTest(common.HeatTestCase):
rpcc = self.res.rpc_client.return_value
rpcc.delete_stack.assert_called_once_with(
self.ctx,
- self.res.nested().identifier())
+ self.res.nested().identifier(),
+ cast=False)
diff --git a/heat/tests/test_stack_resource.py b/heat/tests/test_stack_resource.py
index 03dc6ae5b..d2a75d8ae 100644
--- a/heat/tests/test_stack_resource.py
+++ b/heat/tests/test_stack_resource.py
@@ -516,7 +516,7 @@ class StackResourceTest(StackResourceBaseTest):
side_effect=exception.NotFound())
self.assertIsNone(self.parent_resource.delete_nested())
rpcc.return_value.delete_stack.assert_called_once_with(
- self.parent_resource.context, mock.ANY)
+ self.parent_resource.context, mock.ANY, cast=False)
def test_need_update_for_nested_resource(self):
"""Test the resource with nested stack should need update.