Deleted Stack Fix and ValidationError for DescribeStacks.
* stop backed from trying to iterate over empty list of deleted stacks. * Update DescribeStacks to throw ValidationError if stack name or id doesn't exist.
This commit is contained in:
parent
e67ef8f038
commit
90191675a2
2 changed files with 27 additions and 4 deletions
|
|
@ -5,6 +5,7 @@ from moto.core import BaseBackend
|
|||
|
||||
from .parsing import ResourceMap, OutputMap
|
||||
from .utils import generate_stack_id
|
||||
from .exceptions import ValidationError
|
||||
|
||||
|
||||
class FakeStack(object):
|
||||
|
|
@ -50,10 +51,12 @@ class CloudFormationBackend(BaseBackend):
|
|||
for stack in stacks:
|
||||
if stack.name == name_or_stack_id or stack.stack_id == name_or_stack_id:
|
||||
return [stack]
|
||||
deleted_stacks = self.deleted_stacks.values()
|
||||
for stack in deleted_stacks:
|
||||
if stack.stack_id == name_or_stack_id:
|
||||
return [stack]
|
||||
if self.deleted_stacks:
|
||||
deleted_stacks = self.deleted_stacks.values()
|
||||
for stack in deleted_stacks:
|
||||
if stack.stack_id == name_or_stack_id:
|
||||
return [stack]
|
||||
raise ValidationError(name_or_stack_id)
|
||||
else:
|
||||
return stacks
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue