mirror of
https://github.com/cisagov/manage.get.gov.git
synced 2025-08-05 17:28:31 +02:00
Log list of domains that failed to disclose
This commit is contained in:
parent
22ace8aee9
commit
7da1d81369
1 changed files with 17 additions and 18 deletions
|
@ -24,9 +24,9 @@ class Command(BaseCommand):
|
|||
# domains with errors, which are not successfully updated to disclose
|
||||
self.domains_with_errors: list[str] = []
|
||||
# domains that are successfully disclosed
|
||||
self.disclosed_domain_contacts_counter = 0
|
||||
self.disclosed_domain_contacts_count = 0
|
||||
# domains that skip disclose due to having contact registrar@dotgov.gov
|
||||
self.skipped_domain_contacts_counter = 0
|
||||
self.skipped_domain_contacts_count = 0
|
||||
|
||||
def handle(self, **options):
|
||||
"""
|
||||
|
@ -40,42 +40,41 @@ class Command(BaseCommand):
|
|||
statuses = [Domain.State.READY, Domain.State.DNS_NEEDED]
|
||||
domains = Domain.objects.filter(state__in=statuses)
|
||||
|
||||
logger.info("Found %d domains with status Ready or DNS Needed.", len(domains))
|
||||
logger.info(f"Found {len(domains)} domains with status Ready or DNS Needed.")
|
||||
|
||||
# Call security_contact on all domains to trigger saving contact information
|
||||
for domain in domains:
|
||||
contact = domain.security_contact
|
||||
self.contacts_saved_count++
|
||||
self.contacts_saved_count+=1
|
||||
|
||||
logger.info("Found %d security contacts.", self.contacts_saved)
|
||||
logger.info(f"Found {self.contacts_saved_count} security contacts.")
|
||||
|
||||
# Update EPP contact for domains with a security contact
|
||||
for domain in domains:
|
||||
try:
|
||||
logger.info("Domain %s security contact: %s", domain.domain_name, domain.security_contact.email)
|
||||
logger.info(
|
||||
f"Domain {domain.domain_info} security contact: {domain.security_contact.email}"
|
||||
)
|
||||
if domain.security_contact.email != "registrar@dotgov.gov":
|
||||
domain._update_epp_contact(contact=domain.security_contact)
|
||||
self.disclosed_domain_contacts++
|
||||
self.disclosed_domain_contacts_count+=1
|
||||
else:
|
||||
logger.info(
|
||||
"Skipping disclose for %s security contact %s.",
|
||||
domain.domain_name,
|
||||
domain.security_contact.email,
|
||||
f"Skipping disclose for {domain.domain_info} security contact {domain.security_contact.email}."
|
||||
)
|
||||
self.skipped_domain_contacts++
|
||||
self.skipped_domain_contacts_count+=1
|
||||
except Exception as err:
|
||||
# error condition if domain not in database
|
||||
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.domaidomain_infon_name} contact {domain.security_contact}: {err}"
|
||||
)
|
||||
|
||||
# Inform user how many contacts were disclosed, skipped, and errored
|
||||
logger.info("Updated %d contacts to disclosed.", self.disclosed_domain_contacts)
|
||||
logger.info(f"Updated {self.disclosed_domain_contacts_count} contacts to disclosed.")
|
||||
logger.info(
|
||||
"Skipped disclosing %d contacts with security email registrar@dotgov.gov.",
|
||||
self.skipped_domain_contacts
|
||||
f"Skipped disclosing {self.skipped_domain_contacts_count} contacts with security email registrar@dotgov.gov."
|
||||
)
|
||||
logger.info(
|
||||
"Error disclosing the following %d contacts: s",
|
||||
len(self.domains_with_errors),
|
||||
self.domains_with_errors
|
||||
f"Error disclosing the following {len(self.domains_with_errors)} contacts: {self.domains_with_errors}"
|
||||
)
|
Loading…
Add table
Add a link
Reference in a new issue