Change checks for handling same layer name un different stack
This commit is contained in:
parent
7599fd5dc0
commit
4393a4f76c
@ -422,11 +422,11 @@ class OpsWorksBackend(BaseBackend):
|
|||||||
stackid = kwargs['stack_id']
|
stackid = kwargs['stack_id']
|
||||||
if stackid not in self.stacks:
|
if stackid not in self.stacks:
|
||||||
raise ResourceNotFoundException(stackid)
|
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(
|
raise ValidationException(
|
||||||
'There is already a layer named "{0}" '
|
'There is already a layer named "{0}" '
|
||||||
'for this stack'.format(name))
|
'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(
|
raise ValidationException(
|
||||||
'There is already a layer with shortname "{0}" '
|
'There is already a layer with shortname "{0}" '
|
||||||
'for this stack'.format(shortname))
|
'for this stack'.format(shortname))
|
||||||
|
@ -24,16 +24,16 @@ def test_create_layer_response():
|
|||||||
Name="TestLayer",
|
Name="TestLayer",
|
||||||
Shortname="TestLayerShortName"
|
Shortname="TestLayerShortName"
|
||||||
)
|
)
|
||||||
|
|
||||||
response.should.contain("LayerId")
|
response.should.contain("LayerId")
|
||||||
|
|
||||||
second_stack_id = client.create_stack(
|
second_stack_id = client.create_stack(
|
||||||
Name="test_stack_2",
|
Name="test_stack_2",
|
||||||
Region="us-east-1",
|
Region="us-east-1",
|
||||||
ServiceRoleArn="service_arn",
|
ServiceRoleArn="service_arn",
|
||||||
DefaultInstanceProfileArn="profile_arn"
|
DefaultInstanceProfileArn="profile_arn"
|
||||||
)['StackId']
|
)['StackId']
|
||||||
|
|
||||||
response = client.create_layer(
|
response = client.create_layer(
|
||||||
StackId=second_stack_id,
|
StackId=second_stack_id,
|
||||||
Type="custom",
|
Type="custom",
|
||||||
|
Loading…
Reference in New Issue
Block a user