When replacing a domain name in the template: Domain -> FQDN.
This commit is contained in:
parent
63b32d8932
commit
35072753d4
@ -98,7 +98,7 @@ class DNSManager::Storage
|
|||||||
update_user_data user_data
|
update_user_data user_data
|
||||||
|
|
||||||
# Add the new zone in the database.
|
# 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
|
Response::Success.new
|
||||||
end
|
end
|
||||||
|
@ -399,14 +399,16 @@ class DNSManager::Storage::Zone
|
|||||||
|
|
||||||
# When a new domain is recorded, we load a template which contains a placeholder domain.
|
# 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.
|
# `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)
|
def replace_domain(new_domain : String)
|
||||||
@domain = new_domain
|
@domain = new_domain
|
||||||
|
fqdn = "#{new_domain}."
|
||||||
@resources.each do |rr|
|
@resources.each do |rr|
|
||||||
case rr
|
case rr
|
||||||
when SOA
|
when SOA
|
||||||
rr.name = domain
|
rr.name = fqdn
|
||||||
when NS
|
when NS
|
||||||
rr.name = domain
|
rr.name = fqdn
|
||||||
else
|
else
|
||||||
Baguette::Log.debug "new domain, rr type #{rr.class} (nothing to do)"
|
Baguette::Log.debug "new domain, rr type #{rr.class} (nothing to do)"
|
||||||
end
|
end
|
||||||
|
Loading…
Reference in New Issue
Block a user