Mentions légales du service

Skip to content
Snippets Groups Projects
Commit 2a033995 authored by IMBERT Matthieu's avatar IMBERT Matthieu
Browse files

[dhcp] fix: different names for Host entries of multiple ifaces in dhcpd confs

parent 244f31dd
No related branches found
No related tags found
No related merge requests found
......@@ -23,8 +23,10 @@ def get_network_info(node_hash, network_interface)
mac = a.fetch('mac')
ip = a.fetch('ip', nil)
ip6 = a.fetch('ip6', nil)
name = a.fetch('network_address').split('.')[0] rescue node_hash['uid']
if (not ip.nil?) or (not ip6.nil?)
network_infos << {'mac' => mac,
'name' => name,
'ip' => ip,
'ip6' => ip6 }
end
......
......@@ -11,17 +11,16 @@
data.fetch('nodes').each_sort_by_node_uid { |node_uid, node|
next if node == nil || (node['status'] && node['status'] == 'retired')
case network_interface
when 'bmc', 'adm', 'mic0'
uid_net = node_uid + '-' + network_interface
else
uid_net = node_uid
end
# Get ipv4, ipv6 and mac addresses
begin
ifinfos = get_network_info(node, network_interface)
ifinfos.each do |h|
case network_interface
when 'bmc', 'adm', 'mic0'
uid_net = node_uid + '-' + network_interface
else
uid_net = h['name']
end
if dhcpkind == 'dhcpv6'
if h['ip6']
dhcp_entries.push({ 'uid_net' => uid_net, 'ipv6' => h['ip6'], 'mac' => h['mac'] })
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment