ELBv2.create_listener links TargetGroup to LB
In order to search target_groups by LB, we need this link in place. Resolves #1500
This commit is contained in:
parent
553d074241
commit
9a8b36debc
@ -486,6 +486,10 @@ class ELBv2Backend(BaseBackend):
|
|||||||
arn = load_balancer_arn.replace(':loadbalancer/', ':listener/') + "/%s%s" % (port, id(self))
|
arn = load_balancer_arn.replace(':loadbalancer/', ':listener/') + "/%s%s" % (port, id(self))
|
||||||
listener = FakeListener(load_balancer_arn, arn, protocol, port, ssl_policy, certificate, default_actions)
|
listener = FakeListener(load_balancer_arn, arn, protocol, port, ssl_policy, certificate, default_actions)
|
||||||
balancer.listeners[listener.arn] = listener
|
balancer.listeners[listener.arn] = listener
|
||||||
|
for action in default_actions:
|
||||||
|
if action['target_group_arn'] in self.target_groups.keys():
|
||||||
|
target_group = self.target_groups[action['target_group_arn']]
|
||||||
|
target_group.load_balancer_arns.append(load_balancer_arn)
|
||||||
return listener
|
return listener
|
||||||
|
|
||||||
def describe_load_balancers(self, arns, names):
|
def describe_load_balancers(self, arns, names):
|
||||||
|
@ -340,6 +340,10 @@ def test_create_target_group_and_listeners():
|
|||||||
'Type': 'forward'}])
|
'Type': 'forward'}])
|
||||||
http_listener_arn = listener.get('ListenerArn')
|
http_listener_arn = listener.get('ListenerArn')
|
||||||
|
|
||||||
|
response = conn.describe_target_groups(LoadBalancerArn=load_balancer_arn,
|
||||||
|
Names=['a-target'])
|
||||||
|
response.get('TargetGroups').should.have.length_of(1)
|
||||||
|
|
||||||
# And another with SSL
|
# And another with SSL
|
||||||
response = conn.create_listener(
|
response = conn.create_listener(
|
||||||
LoadBalancerArn=load_balancer_arn,
|
LoadBalancerArn=load_balancer_arn,
|
||||||
|
Loading…
Reference in New Issue
Block a user