Removing a domain: domain may not have tokens.

This commit is contained in:
Philippe PITTOLI 2024-06-02 01:58:56 +02:00
parent de8beb0df8
commit 5cbcbdaa8f
2 changed files with 11 additions and 8 deletions

View File

@ -11,7 +11,7 @@ endif
# No idea why, but I need that to run applications. Ignore that.
#LD_P ?= LD_PRELOAD=/usr/local/lib/libipc.so.0
OPTS ?= --progress --no-debug
OPTS ?= --progress
Q ?= @

View File

@ -334,12 +334,14 @@ class DNSManager::Storage
return Response::DomainDeleted.new domain_name
end
# Remove this domain_name from the list of user's domains.
domains_by_name.delete domain_name
# Remove the related zone and their registered tokens.
zones_by_domain.delete domain_name
tokens_by_domain.delete domain_name
# The domain may not have tokens.
tokens_by_domain.delete? domain_name
# Remove this domain_name from the list of user's domains.
domains_by_name.delete domain_name
Response::DomainDeleted.new domain_name
end
@ -382,9 +384,10 @@ class DNSManager::Storage
# Remove the user's domain when he is the only owner.
if domain_cloned.owners.empty?
@domains_by_name.delete domain_cloned.name
@tokens_by_domain.delete domain_cloned.name
@zones_by_domain.delete domain_cloned.name
# The domain may not have tokens.
@tokens_by_domain.delete? domain_cloned.name
@zones_by_domain.delete domain_cloned.name
@domains_by_name.delete domain_cloned.name
else
@domains_by_name.update domain_cloned
end