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: diff --git a/ocw/lib/emailnotify.py b/ocw/lib/emailnotify.py index fb4c7b2..f2fe6dd 100644 --- a/ocw/lib/emailnotify.py +++ b/ocw/lib/emailnotify.py @@ -1,4 +1,3 @@ -from datetime import timedelta import smtplib import logging from email.mime.text import MIMEText @@ -6,7 +5,6 @@ from django.urls import reverse from webui.PCWConfig import PCWConfig from webui.settings import build_absolute_uri -from ..models import Instance logger = logging.getLogger(__name__) diff --git a/ocw/tables.py b/ocw/tables.py index 728c62e..c60d485 100644 --- a/ocw/tables.py +++ b/ocw/tables.py @@ -32,6 +32,7 @@ def render(self, record): link['url'], link['title'], link['title'], static('img/openqa.svg')) return "" + class TagsColumn(tables.TemplateColumn): def __init__(self, template_name=None, **extra): diff --git a/tests/test_db.py b/tests/test_db.py index e2728fd..b690746 100644 --- a/tests/test_db.py +++ b/tests/test_db.py @@ -179,7 +179,6 @@ def mocked__update_provider(arg1, arg2, arg3): def mocked_auto_delete_instances(): call_stack.append('auto_delete_instances') - monkeypatch.setattr('ocw.lib.db._update_provider', mocked__update_provider) monkeypatch.setattr('ocw.lib.db.auto_delete_instances', mocked_auto_delete_instances)