Commit ab3e7be2 authored by IMBERT Matthieu's avatar IMBERT Matthieu
Browse files

[gen] ipv6: fix network_adapter select + add code to fail on unhandled cases

parent 96d0404b
Pipeline #133186 passed with stages
in 4 minutes and 43 seconds
...@@ -114,8 +114,10 @@ def add_ipv6(h) ...@@ -114,8 +114,10 @@ def add_ipv6(h)
hc['nodes'].each_pair do |node_uid, hn| hc['nodes'].each_pair do |node_uid, hn|
# get IPv4 # get IPv4
ip4 = nil ip4 = nil
num_main_interfaces = 0
hn['network_adapters'].each_pair do |iface, nh| hn['network_adapters'].each_pair do |iface, nh|
if nh['mountable'] == true and nh['interface'] == 'Ethernet' if nh['mounted'] == true && nh['interface'] == 'Ethernet' && nh['management'] == false
num_main_interfaces += 1
# for mounted && ethernet interfaces only # for mounted && ethernet interfaces only
ip4 = nh['ip'] ip4 = nh['ip']
if not ip4.nil? if not ip4.nil?
...@@ -132,6 +134,9 @@ def add_ipv6(h) ...@@ -132,6 +134,9 @@ def add_ipv6(h)
# for all other cases, force no IPv6 # for all other cases, force no IPv6
nh.delete('ip6') nh.delete('ip6')
end end
if num_main_interfaces > 1
raise "#{node_uid}.#{site_uid}: more than one interface with mounted == true && interface == 'Ethernet' && management == false"
end
end end
end end
end end
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment