Removes the Bind9 zone file.

This commit is contained in:
Philippe PITTOLI 2024-07-02 14:36:49 +02:00
parent 2d64da170e
commit 98b5ed2638

View File

@ -159,7 +159,7 @@ class DNSManager::Storage
@domains << the_new_domain @domains << the_new_domain
# Add the new zone in the database. # Add the new zone in the database.
zones_by_domain.update_or_create domain, default_zone update_zone default_zone
Response::DomainAdded.new domain Response::DomainAdded.new domain
end end
@ -253,10 +253,7 @@ class DNSManager::Storage
domains << Domain.new zone.domain domains << Domain.new zone.domain
end end
# Add -or replace- the zone. update_zone zone
zones_by_domain.update_or_create zone.domain, zone
generate_bind9_zonefile zone.domain
Response::Success.new Response::Success.new
end end
@ -277,8 +274,6 @@ class DNSManager::Storage
update_zone zone update_zone zone
generate_bind9_zonefile zone.domain
Response::RRAdded.new zone.domain, rr Response::RRAdded.new zone.domain, rr
end end
@ -334,9 +329,10 @@ class DNSManager::Storage
Response::RRDeleted.new rrid Response::RRDeleted.new rrid
end end
# TODO: removes a Bind9 zonefile. # Removes a Bind9 zonefile.
def remove_bind9_zonefile(domain : String) : Nil def remove_bind9_zonefile(domain : String) : Nil
Baguette::Log.info "Removing a Bind9 zone file." Baguette::Log.info "Removing a Bind9 zone file."
File.delete "#{@zonefiledir}/#{domain}"
end end
# Deletes a domain. # Deletes a domain.