From c9f42bc1ce913e3863267189f1ad98df22e67695 Mon Sep 17 00:00:00 2001 From: Anton Smorodskyi Date: Mon, 16 Sep 2024 22:02:47 +0200 Subject: [PATCH] Mute common error when deleting VPC --- ocw/lib/ec2.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/ocw/lib/ec2.py b/ocw/lib/ec2.py index f1834b7..d4eb33d 100644 --- a/ocw/lib/ec2.py +++ b/ocw/lib/ec2.py @@ -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: