Add logs for skipped disclose contacts

This commit is contained in:
Erin 2024-01-10 14:35:59 -08:00
parent 0a13ff9976
commit f87be48c47
No known key found for this signature in database
GPG key ID: 1CAD275313C62460

View file

@ -21,6 +21,8 @@ class Command(BaseCommand):
self.domains_with_errors: List[str] = [] self.domains_with_errors: List[str] = []
# domains that are successfully disclosed # domains that are successfully disclosed
self.disclosed_domain_contacts: List[str] = [] self.disclosed_domain_contacts: List[str] = []
# domains that skip disclose due to having contact registrar@dotgov.gov
self.skipped_domain_contacts: List[str] = []
def handle(self, **options): def handle(self, **options):
""" """
@ -48,14 +50,17 @@ class Command(BaseCommand):
domain._update_epp_contact(contact=domain.security_contact) domain._update_epp_contact(contact=domain.security_contact)
self.disclosed_domain_contacts.append(copy.deepcopy(domain.security_contact)) self.disclosed_domain_contacts.append(copy.deepcopy(domain.security_contact))
else: else:
logger.info("Skipping disclose for %s security contact.", logger.info("Skipping disclose for %s security contact %s.",
domain.domain_info, domain.security_contact.email) domain.domain_info, domain.security_contact.email)
self.skipped_domain_contacts.append(copy.deepcopy(domain.security_contact))
except Exception as err: except Exception as err:
# error condition if domain not in database # error condition if domain not in database
self.domains_with_errors.append(copy.deepcopy(domain.domain_info)) self.domains_with_errors.append(copy.deepcopy(domain.domain_info))
logger.error(f"error retrieving domain {domain.domain_info}: {err}") logger.error(f"error retrieving domain {domain.domain_info}: {err}")
# Inform user how many contacts were disclosed # Inform user how many contacts were disclosed and skipped
logger.info("Updated %d contacts to disclosed.", len(self.disclosed_domain_contacts)) logger.info("Updated %d contacts to disclosed.", len(self.disclosed_domain_contacts))
logger.info("Skipped disclosing %d contacts with security email registrar@dotgov.gov.",
len(self.skipped_domain_contacts))