Skip to content

Commit

Permalink
Mute common error when deleting VPC
Browse files Browse the repository at this point in the history
  • Loading branch information
asmorodskyi committed Sep 16, 2024
1 parent 684a131 commit c9f42bc
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion ocw/lib/ec2.py
Original file line number Diff line number Diff line change
Expand Up @@ -325,7 +325,12 @@ def vpc_can_be_deleted(self, resource_vpc, vpc_id) -> bool:

def report_cleanup_results(self, vpc_errors: list, vpc_notify: list, vpc_locked: list) -> None:
if len(vpc_errors) > 0:
send_mail(f'Errors on VPC deletion in [{self._namespace}]', '\n'.join(vpc_errors))
# this is most common error message which we can not fix.
# So no point to spam us with notifications about it
known_error = "An error occurred (DependencyViolation) when calling the DeleteVpc operation"
filtered = [x for x in vpc_errors if known_error not in x]
if len(filtered) > 0:
send_mail(f'Errors on VPC deletion in [{self._namespace}]', '\n'.join(vpc_errors))
if len(vpc_notify) > 0:
send_mail(f'{len(vpc_notify)} VPC\'s should be deleted, skipping due vpc-notify-only=True', ','.join(vpc_notify))
if len(vpc_locked) > 0:
Expand Down

0 comments on commit c9f42bc

Please sign in to comment.