mirror of
https://github.com/cisagov/manage.get.gov.git
synced 2025-07-21 18:25:58 +02:00
handling of OBJECT_EXISTS in nameserver create_host and update_host methods
This commit is contained in:
parent
918c5ef0b2
commit
662bb1a1ef
1 changed files with 12 additions and 2 deletions
|
@ -277,7 +277,12 @@ class Domain(TimeStampedModel, DomainHelper):
|
|||
return response.code
|
||||
except RegistryError as e:
|
||||
logger.error("Error _create_host, code was %s error was %s" % (e.code, e))
|
||||
raise e
|
||||
# OBJECT_EXISTS is an expected error code that should not raise
|
||||
# an exception, rather return the code to be handled separately
|
||||
if response and response.code == ErrorCode.OBJECT_EXISTS:
|
||||
return response.code
|
||||
else:
|
||||
raise e
|
||||
|
||||
def _convert_list_to_dict(self, listToConvert: list[tuple[str, list]]):
|
||||
"""converts a list of hosts into a dictionary
|
||||
|
@ -1625,7 +1630,12 @@ class Domain(TimeStampedModel, DomainHelper):
|
|||
return response.code
|
||||
except RegistryError as e:
|
||||
logger.error("Error _update_host, code was %s error was %s" % (e.code, e))
|
||||
raise e
|
||||
# OBJECT_EXISTS is an expected error code that should not raise
|
||||
# an exception, rather return the code to be handled separately
|
||||
if response and response.code == ErrorCode.OBJECT_EXISTS:
|
||||
return response.code
|
||||
else:
|
||||
raise e
|
||||
|
||||
def addAndRemoveHostsFromDomain(
|
||||
self, hostsToAdd: list[str], hostsToDelete: list[str]
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue