mirror of
https://github.com/cisagov/manage.get.gov.git
synced 2025-07-23 03:06:01 +02:00
some error validation, light refactor of ip checking in model
This commit is contained in:
parent
16164f1f05
commit
51307d3b12
4 changed files with 45 additions and 13 deletions
|
@ -313,14 +313,14 @@ class Domain(TimeStampedModel, DomainHelper):
|
|||
NameserverError (if exception hit)
|
||||
Returns:
|
||||
None"""
|
||||
if self.isSubdomain(nameserver) and (ip is None or ip == []):
|
||||
if self.isSubdomain(nameserver) and (ip is None or ip == [] or ip != []):
|
||||
raise NameserverError(code=nsErrorCodes.MISSING_IP, nameserver=nameserver)
|
||||
|
||||
elif not self.isSubdomain(nameserver) and (ip is not None and ip != []):
|
||||
elif not self.isSubdomain(nameserver) and (ip is not None and ip != [] and ip != ['']):
|
||||
raise NameserverError(
|
||||
code=nsErrorCodes.GLUE_RECORD_NOT_ALLOWED, nameserver=nameserver, ip=ip
|
||||
)
|
||||
elif ip is not None and ip != []:
|
||||
elif ip is not None and ip != [] and ip != ['']:
|
||||
for addr in ip:
|
||||
logger.info(f"ip address {addr}")
|
||||
if not self._valid_ip_addr(addr):
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue