Merge pull request #2709 from blbradley/fix/localstack-split-stacks
throw ValidationError on non existing stack
This commit is contained in:
commit
70b2d3ab3c
@ -677,6 +677,8 @@ class CloudFormationBackend(BaseBackend):
|
|||||||
|
|
||||||
def list_stack_resources(self, stack_name_or_id):
|
def list_stack_resources(self, stack_name_or_id):
|
||||||
stack = self.get_stack(stack_name_or_id)
|
stack = self.get_stack(stack_name_or_id)
|
||||||
|
if stack is None:
|
||||||
|
return None
|
||||||
return stack.stack_resources
|
return stack.stack_resources
|
||||||
|
|
||||||
def delete_stack(self, name_or_stack_id):
|
def delete_stack(self, name_or_stack_id):
|
||||||
|
@ -229,6 +229,9 @@ class CloudFormationResponse(BaseResponse):
|
|||||||
stack_name_or_id = self._get_param("StackName")
|
stack_name_or_id = self._get_param("StackName")
|
||||||
resources = self.cloudformation_backend.list_stack_resources(stack_name_or_id)
|
resources = self.cloudformation_backend.list_stack_resources(stack_name_or_id)
|
||||||
|
|
||||||
|
if resources is None:
|
||||||
|
raise ValidationError(stack_name_or_id)
|
||||||
|
|
||||||
template = self.response_template(LIST_STACKS_RESOURCES_RESPONSE)
|
template = self.response_template(LIST_STACKS_RESOURCES_RESPONSE)
|
||||||
return template.render(resources=resources)
|
return template.render(resources=resources)
|
||||||
|
|
||||||
|
@ -522,6 +522,13 @@ def test_boto3_list_stack_set_operations():
|
|||||||
list_operation["Summaries"][-1]["Action"].should.equal("UPDATE")
|
list_operation["Summaries"][-1]["Action"].should.equal("UPDATE")
|
||||||
|
|
||||||
|
|
||||||
|
@mock_cloudformation
|
||||||
|
def test_boto3_bad_list_stack_resources():
|
||||||
|
cf_conn = boto3.client("cloudformation", region_name="us-east-1")
|
||||||
|
with assert_raises(ClientError):
|
||||||
|
cf_conn.list_stack_resources(StackName="test_stack_set")
|
||||||
|
|
||||||
|
|
||||||
@mock_cloudformation
|
@mock_cloudformation
|
||||||
def test_boto3_delete_stack_set():
|
def test_boto3_delete_stack_set():
|
||||||
cf_conn = boto3.client("cloudformation", region_name="us-east-1")
|
cf_conn = boto3.client("cloudformation", region_name="us-east-1")
|
||||||
|
Loading…
Reference in New Issue
Block a user