From 98b5ed2638f413ea351be85e310ecd09c7f6523a Mon Sep 17 00:00:00 2001 From: Philippe PITTOLI Date: Tue, 2 Jul 2024 14:36:49 +0200 Subject: [PATCH] Removes the Bind9 zone file. --- src/storage.cr | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/src/storage.cr b/src/storage.cr index 5c3a620..34efb07 100644 --- a/src/storage.cr +++ b/src/storage.cr @@ -159,7 +159,7 @@ class DNSManager::Storage @domains << the_new_domain # Add the new zone in the database. - zones_by_domain.update_or_create domain, default_zone + update_zone default_zone Response::DomainAdded.new domain end @@ -253,10 +253,7 @@ class DNSManager::Storage domains << Domain.new zone.domain end - # Add -or replace- the zone. - zones_by_domain.update_or_create zone.domain, zone - - generate_bind9_zonefile zone.domain + update_zone zone Response::Success.new end @@ -277,8 +274,6 @@ class DNSManager::Storage update_zone zone - generate_bind9_zonefile zone.domain - Response::RRAdded.new zone.domain, rr end @@ -334,9 +329,10 @@ class DNSManager::Storage Response::RRDeleted.new rrid end - # TODO: removes a Bind9 zonefile. + # Removes a Bind9 zonefile. def remove_bind9_zonefile(domain : String) : Nil Baguette::Log.info "Removing a Bind9 zone file." + File.delete "#{@zonefiledir}/#{domain}" end # Deletes a domain.