orchestration: tolerate NotFound in wait_for_stack_status
When waiting for a stack to transition to DELETE_COMPLETE status
it's possible to either get that status, or a NotFound exception
so catch the exception and return in that case, to avoid needing
try/except around the wait, or risking races in tests which wait
for DELETE_COMPLETE without a try/except (test_volumes.py)
Change-Id: I4ded172db3c8969075365a0dc6b60d8e3e7db71d
Partial-Bug: #1344989
diff --git a/tempest/api/orchestration/base.py b/tempest/api/orchestration/base.py
index f83169f..531df2d 100644
--- a/tempest/api/orchestration/base.py
+++ b/tempest/api/orchestration/base.py
@@ -85,11 +85,8 @@
pass
for stack_identifier in cls.stacks:
- try:
- cls.client.wait_for_stack_status(
- stack_identifier, 'DELETE_COMPLETE')
- except exceptions.NotFound:
- pass
+ cls.client.wait_for_stack_status(
+ stack_identifier, 'DELETE_COMPLETE')
@classmethod
def _create_keypair(cls, name_start='keypair-heat-'):
diff --git a/tempest/services/orchestration/json/orchestration_client.py b/tempest/services/orchestration/json/orchestration_client.py
index d325eb5..46b0ec4 100644
--- a/tempest/services/orchestration/json/orchestration_client.py
+++ b/tempest/services/orchestration/json/orchestration_client.py
@@ -181,7 +181,11 @@
fail_regexp = re.compile(failure_pattern)
while True:
- resp, body = self.get_stack(stack_identifier)
+ try:
+ resp, body = self.get_stack(stack_identifier)
+ except exceptions.NotFound:
+ if status == 'DELETE_COMPLETE':
+ return
stack_name = body['stack_name']
stack_status = body['stack_status']
if stack_status == status: