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
This commit is contained in:
Steven Hardy
2014-07-24 14:51:25 +01:00
parent 60b9ccab46
commit 6149e1a24f
2 changed files with 7 additions and 6 deletions

View File

@@ -85,11 +85,8 @@ class BaseOrchestrationTest(tempest.test.BaseTestCase):
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-'):

View File

@@ -181,7 +181,11 @@ class OrchestrationClient(rest_client.RestClient):
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: