Delegation: some final steps.

This commit is contained in:
Philippe Pittoli 2025-08-13 02:56:41 +02:00
parent f817927c4d
commit adf223fe38

View file

@ -392,13 +392,13 @@ class DNSManager::Storage
# Removes a delegation file, then update the token file.
def remove_delegation_file(domain : String) : Nil
Baguette::Log.info "Removing a delegation file."
Baguette::Log.info "(domain #{domain}) removing a delegation file."
File.delete "#{@delegationdir}/#{domain}"
end
# Removes a Bind9 zonefile.
def remove_bind9_zonefile(domain : String) : Nil
Baguette::Log.info "Removing a Bind9 zone file."
Baguette::Log.info "(domain #{domain}) removing a Bind9 zone file."
File.delete "#{@zonefiledir}/#{domain}"
end
@ -478,17 +478,16 @@ class DNSManager::Storage
# Remove the user's domain when he is the only owner.
if domain_cloned.owners.empty?
# 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
remove_bind9_zonefile domain_cloned.name
wipe_domain user_id, domain.name
wipe_zone user_id, domain.name
else
@domains_by_name.update domain_cloned
end
rescue e
Baguette::Log.error "while removing the domain #{domain.name}: #{e}"
end
rescue e
Baguette::Log.error "while removing a domain: #{e}"
Baguette::Log.error "while removing all user data (uid: #{user_id}): #{e}"
end
# Removes user data.
@ -563,6 +562,9 @@ class DNSManager::Storage
# Remove the delegation file and regenerate the delegation files.
if delegation = zone.delegation
remove_delegation_file domain_name
# Once the new delegation file has been removed, the script generating the (root) zone file must
# be informed by touching a file (named "delegation token file" in the source code).
update_delegation_token_file
end
# There is no need to keep a generated zone file.