Mentions légales du service

Skip to content
Snippets Groups Projects
Commit f4925301 authored by LOUP David's avatar LOUP David
Browse files

Merge branch 'bug_12464' into 'master'

[gen/puppet/bindg5k] deterministic sorting of CNAME records #12464

See merge request !149
parents 3e5cc6f8 894e6a1e
No related branches found
No related tags found
1 merge request!149[gen/puppet/bindg5k] deterministic sorting of CNAME records #12464
Pipeline #189028 passed
...@@ -386,14 +386,16 @@ def sort_records(records) ...@@ -386,14 +386,16 @@ def sort_records(records)
cnames.sort_by!{ |record| cnames.sort_by!{ |record|
sort_by = record.label sort_by = record.label
label_array = record.label.split("-") label_array = record.label.split("-")
if label_array.length >= 4 and (Integer(label_array[3]) rescue false) if label_array.length > 1 and label_array[1] !~ /\D/
if label_array[1].to_i != 0 && label_array[3].to_i != 0 sort_by = (record.label.match(/ipv6/).nil? ? [0] : [1]) # -ipv6 at end
sort_by = [label_array.length, label_array[3].to_i, label_array[1].to_i] sort_by << label_array.length # sort by record 'type'
end sort_by << record.label.scan(/-(\d+)-?/).flatten.map{ |i| i.to_i} # sort by node then kavlan number
elsif label_array.length > 1 intf = record.label.scan(/((eth|en)\w+)-?/).flatten.first # detect intf
if label_array[1].to_i != 0 unless intf.nil?
sort_by = [ label_array.length, label_array[1].to_i ] sort_by << (record.label.match(/eth/).nil? ? [1] : [0]) # ethX first
sort_by << intf.scan(/\d+/).reverse.map{ |i| i.to_i } # sort intf
end end
sort_by.flatten!
end end
sort_by sort_by
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment