From 817abb2ca81858a20c93055a6d83219122923677 Mon Sep 17 00:00:00 2001 From: sayali Date: Mon, 30 Nov 2020 11:15:23 -0800 Subject: [PATCH] Removed for loop --- lemur/plugins/lemur_aws/elb.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lemur/plugins/lemur_aws/elb.py b/lemur/plugins/lemur_aws/elb.py index 1da29276..cec0a803 100644 --- a/lemur/plugins/lemur_aws/elb.py +++ b/lemur/plugins/lemur_aws/elb.py @@ -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(