When replacing a domain name in the template: Domain -> FQDN.

master
Philippe Pittoli 2023-06-30 00:12:40 +02:00
parent 63b32d8932
commit 35072753d4
2 changed files with 5 additions and 3 deletions

View File

@ -98,7 +98,7 @@ class DNSManager::Storage
update_user_data user_data
# Add the new zone in the database.
zones_by_domain.update_or_create default_zone.domain, default_zone
zones_by_domain.update_or_create domain, default_zone
Response::Success.new
end

View File

@ -399,14 +399,16 @@ class DNSManager::Storage::Zone
# When a new domain is recorded, we load a template which contains a placeholder domain.
# `replace_domain` replaces this domain name by the real one in the different (preloaded) RR.
# Do not forget the last dot ('.') to get a fully qualified domain name (FQDN).
def replace_domain(new_domain : String)
@domain = new_domain
fqdn = "#{new_domain}."
@resources.each do |rr|
case rr
when SOA
rr.name = domain
rr.name = fqdn
when NS
rr.name = domain
rr.name = fqdn
else
Baguette::Log.debug "new domain, rr type #{rr.class} (nothing to do)"
end