Treat DELETE_COMPLETE stacks as NotFound

When a stack has just been deleted, fetching it may return a
DELETE_COMPLETE stack or raise a NotFound error.

Recent changes have resulted in the former happening more frequently
causing shade gate failures [1]. This commit changes get_stack to
treat a DELETE_COMPLETE stack the same as a NotFound stack.

[1] http://paste.openstack.org/show/521286/

Change-Id: I3ca0b55c1c10cf229987551c09fcce853faa3584
This commit is contained in:
Steve Baker 2016-06-23 09:03:31 +12:00
parent b2fe8c6301
commit 8481c6baa2

View File

@ -2090,8 +2090,12 @@ class OpenStackCloud(object):
# so a StackGet can always be used for name or ID.
with _utils.shade_exceptions("Error fetching stack"):
try:
stacks = [self.manager.submitTask(
_tasks.StackGet(stack_id=name_or_id))]
stack = self.manager.submitTask(
_tasks.StackGet(stack_id=name_or_id))
# Treat DELETE_COMPLETE stacks as a NotFound
if stack['stack_status'] == 'DELETE_COMPLETE':
return []
stacks = [stack]
except heat_exceptions.NotFound:
return []
nstacks = _utils.normalize_stacks(stacks)