def self.get_interface_value(interface, label)
tmp1 = []
kernel = Facter.value(:kernel).downcase.to_sym
unless map = REGEX_MAP[kernel] || REGEX_MAP.values.find { |tmp| tmp[:aliases] and tmp[:aliases].include?(kernel) }
return []
end
regex = map[label.to_sym]
bonddev = get_bonding_master(interface)
if label == 'macaddress' and bonddev
bondinfo = read_proc_net_bonding("/proc/net/bonding/#{bonddev}")
re = /^Slave Interface: #{interface}\b.*?\bPermanent HW addr: (([0-9A-F]{2}:?)*)$/im
if match = re.match(bondinfo)
value = match[1].upcase
end
else
output_int = get_output_for_interface_and_label(interface, label)
output_int.each_line do |s|
if s =~ regex
value = $1
if label == 'netmask' && convert_from_hex?(kernel)
value = value.scan(/../).collect do |byte| byte.to_i(16) end.join('.')
end
tmp1.push(value)
end
end
if tmp1
value = tmp1.shift
end
end
end