Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

prevent an exception going unhandled in get_endpoints #3507

Merged
merged 2 commits into from
Apr 1, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 27 additions & 10 deletions lemur/plugins/lemur_aws/plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -217,19 +217,32 @@ def get_endpoints(self, options, **kwargs):
regions = "".join(regions.split()).split(",")

for region in regions:
elbs = elb.get_all_elbs(account_number=account_number, region=region)
current_app.logger.info({
"message": "Describing classic load balancers",
"account_number": account_number,
"region": region,
"number_of_load_balancers": len(elbs)
})
try:
elbs = elb.get_all_elbs(account_number=account_number, region=region)
current_app.logger.info({
"message": "Describing classic load balancers",
"account_number": account_number,
"region": region,
"number_of_load_balancers": len(elbs)
})
except Exception as e: # noqa
sentry.captureException()
continue

for e in elbs:
endpoints.extend(get_elb_endpoints(account_number, region, e))
try:
endpoints.extend(get_elb_endpoints(account_number, region, e))
except Exception as e: # noqa
sentry.captureException()
continue

# fetch advanced ELBs
elbs_v2 = elb.get_all_elbs_v2(account_number=account_number, region=region)
try:
elbs_v2 = elb.get_all_elbs_v2(account_number=account_number, region=region)
except Exception as e: # noqa
sentry.captureException()
continue

current_app.logger.info({
"message": "Describing advanced load balancers",
"account_number": account_number,
Expand All @@ -238,7 +251,11 @@ def get_endpoints(self, options, **kwargs):
})

for e in elbs_v2:
endpoints.extend(get_elb_endpoints_v2(account_number, region, e))
try:
endpoints.extend(get_elb_endpoints_v2(account_number, region, e))
except Exception as e: # noqa
sentry.captureException()
continue

return endpoints

Expand Down