Removed for loop

This commit is contained in:
sayali 2020-11-30 11:15:23 -08:00
parent a2f731b710
commit 817abb2ca8

View File

@ -160,8 +160,8 @@ def get_load_balancer_arn_from_endpoint(endpoint_name, **kwargs):
try:
client = kwargs.pop("client")
elbs = client.describe_load_balancers(Names=[endpoint_name])
for elb in elbs["LoadBalancers"]:
return elb["LoadBalancerArn"]
if "LoadBalancers" in elbs and elbs["LoadBalancers"]:
return elbs["LoadBalancers"][0]["LoadBalancerArn"]
except Exception as e: # noqa
metrics.send(