Change checks for handling same layer name un different stack

This commit is contained in:
Loukas Leontopoulos 2017-09-25 14:49:08 +03:00
parent 7599fd5dc0
commit 4393a4f76c
2 changed files with 5 additions and 5 deletions

View File

@ -422,11 +422,11 @@ class OpsWorksBackend(BaseBackend):
stackid = kwargs['stack_id']
if stackid not in self.stacks:
raise ResourceNotFoundException(stackid)
if name in [l.name for l in self.layers.values()]:
if name in [l.name for l in self.stacks[stackid].layers]:
raise ValidationException(
'There is already a layer named "{0}" '
'for this stack'.format(name))
if shortname in [l.shortname for l in self.layers.values()]:
if shortname in [l.shortname for l in self.stacks[stackid].layers]:
raise ValidationException(
'There is already a layer with shortname "{0}" '
'for this stack'.format(shortname))

View File

@ -24,16 +24,16 @@ def test_create_layer_response():
Name="TestLayer",
Shortname="TestLayerShortName"
)
response.should.contain("LayerId")
second_stack_id = client.create_stack(
Name="test_stack_2",
Region="us-east-1",
ServiceRoleArn="service_arn",
DefaultInstanceProfileArn="profile_arn"
)['StackId']
response = client.create_layer(
StackId=second_stack_id,
Type="custom",