From ab3e7be24626272473b4b42be1624f41f297b9bc Mon Sep 17 00:00:00 2001 From: Matthieu Imbert <matthieu.imbert@inria.fr> Date: Tue, 31 Mar 2020 11:18:04 +0200 Subject: [PATCH] [gen] ipv6: fix network_adapter select + add code to fail on unhandled cases --- lib/refrepo/input_loader.rb | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/lib/refrepo/input_loader.rb b/lib/refrepo/input_loader.rb index fd88f0401d..69260c6edd 100644 --- a/lib/refrepo/input_loader.rb +++ b/lib/refrepo/input_loader.rb @@ -114,8 +114,10 @@ def add_ipv6(h) hc['nodes'].each_pair do |node_uid, hn| # get IPv4 ip4 = nil + num_main_interfaces = 0 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 ip4 = nh['ip'] if not ip4.nil? @@ -132,6 +134,9 @@ def add_ipv6(h) # for all other cases, force no IPv6 nh.delete('ip6') 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 -- GitLab