mirror of
https://github.com/internetee/registry.git
synced 2025-05-16 17:37:17 +02:00
Story#109070142 - Nameservers ip's are arrays
This commit is contained in:
parent
42225d3298
commit
0af529e8a8
2 changed files with 15 additions and 6 deletions
6
db/migrate/20151130175654_nameservers_i_ps_are_arrays.rb
Normal file
6
db/migrate/20151130175654_nameservers_i_ps_are_arrays.rb
Normal file
|
@ -0,0 +1,6 @@
|
|||
class NameserversIPsAreArrays < ActiveRecord::Migration
|
||||
def change
|
||||
change_column :nameservers, :ipv6, "varchar[] USING (string_to_array(ipv6, ','))", default: []
|
||||
change_column :nameservers, :ipv4, "varchar[] USING (string_to_array(ipv4, ','))", default: []
|
||||
end
|
||||
end
|
|
@ -471,17 +471,20 @@ namespace :import do
|
|||
nsset = x.nsset
|
||||
nsset.hosts.each do |host|
|
||||
ip_maps = host.host_ipaddr_maps
|
||||
ips = {}
|
||||
ips = {
|
||||
ipv4: [],
|
||||
ipv6: [],
|
||||
}
|
||||
ip_maps.each do |ip_map|
|
||||
next unless ip_map.ipaddr
|
||||
ips[:ipv4] = ip_map.ipaddr.to_s if ip_map.ipaddr.ipv4?
|
||||
ips[:ipv6] = ip_map.ipaddr.to_s if ip_map.ipaddr.ipv6?
|
||||
end if ip_maps.any?
|
||||
ips[:ipv4] << ip_map.ipaddr.to_s.strip if ip_map.ipaddr.ipv4?
|
||||
ips[:ipv6] << ip_map.ipaddr.to_s.strip if ip_map.ipaddr.ipv6?
|
||||
end
|
||||
|
||||
nameservers << [
|
||||
host.fqdn.try(:strip),
|
||||
ips[:ipv4].try(:strip),
|
||||
ips[:ipv6].try(:strip),
|
||||
ips[:ipv4],
|
||||
ips[:ipv6],
|
||||
x.object_registry.try(:registrar).try(:name),
|
||||
x.object.try(:registrar).try(:name) ? x.object.try(:registrar).try(:name) : x.object_registry.try(:registrar).try(:name),
|
||||
x.id,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue