Merge branch 'main' into za/850-epp-contact-get

This commit is contained in:
zandercymatics 2023-10-02 12:02:17 -06:00
commit 4217096d8c
No known key found for this signature in database
GPG key ID: FF4636ABEC9682B7
36 changed files with 737 additions and 53 deletions

View file

@ -617,13 +617,25 @@ class Domain(TimeStampedModel, DomainHelper):
"""This domain should not be active.
may raises RegistryError, should be caught or handled correctly by caller"""
request = commands.UpdateDomain(name=self.name, add=[self.clientHoldStatus()])
registry.send(request, cleaned=True)
try:
registry.send(request, cleaned=True)
self._invalidate_cache()
except RegistryError as err:
# if registry error occurs, log the error, and raise it as well
logger.error(f"registry error placing client hold: {err}")
raise (err)
def _remove_client_hold(self):
"""This domain is okay to be active.
may raises RegistryError, should be caught or handled correctly by caller"""
request = commands.UpdateDomain(name=self.name, rem=[self.clientHoldStatus()])
registry.send(request, cleaned=True)
try:
registry.send(request, cleaned=True)
self._invalidate_cache()
except RegistryError as err:
# if registry error occurs, log the error, and raise it as well
logger.error(f"registry error removing client hold: {err}")
raise (err)
def _delete_domain(self):
"""This domain should be deleted from the registry
@ -964,7 +976,9 @@ class Domain(TimeStampedModel, DomainHelper):
administrative_contact = self.get_default_administrative_contact()
administrative_contact.save()
@transition(field="state", source=State.READY, target=State.ON_HOLD)
@transition(
field="state", source=[State.READY, State.ON_HOLD], target=State.ON_HOLD
)
def place_client_hold(self):
"""place a clienthold on a domain (no longer should resolve)"""
# TODO - ensure all requirements for client hold are made here
@ -973,7 +987,7 @@ class Domain(TimeStampedModel, DomainHelper):
self._place_client_hold()
# TODO -on the client hold ticket any additional error handling here
@transition(field="state", source=State.ON_HOLD, target=State.READY)
@transition(field="state", source=[State.READY, State.ON_HOLD], target=State.READY)
def revert_client_hold(self):
"""undo a clienthold placed on a domain"""
@ -1145,9 +1159,14 @@ class Domain(TimeStampedModel, DomainHelper):
if "statuses" in cleaned:
cleaned["statuses"] = [status.state for status in cleaned["statuses"]]
# Capture and store old hosts and contacts from cache if they exist
old_cache_hosts = self._cache.get("hosts")
old_cache_contacts = self._cache.get("contacts")
# get contact info, if there are any
if (
# fetch_contacts and
"_contacts" in cleaned
fetch_contacts
and "_contacts" in cleaned
and isinstance(cleaned["_contacts"], list)
and len(cleaned["_contacts"]) > 0
):