lib/ohai/plugins/network.rb in ohai-8.22.1 vs lib/ohai/plugins/network.rb in ohai-8.23.0
- old
+ new
@@ -75,37 +75,37 @@
# working with the address(es) of the default network interface
gw_if_ips = ips.select do |v|
v[:iface] == network[int_attr]
end
if gw_if_ips.empty?
- Ohai::Log.warn("[#{family}] no ip address on #{network[int_attr]}")
+ Ohai::Log.warn("Plugin Network: [#{family}] no ip address on #{network[int_attr]}")
elsif network[gw_attr] &&
network["interfaces"][network[int_attr]] &&
network["interfaces"][network[int_attr]]["addresses"]
if [ "0.0.0.0", "::", /^fe80:/ ].any? { |pat| pat === network[gw_attr] }
# link level default route
- Ohai::Log.debug("link level default #{family} route, picking ip from #{network[gw_attr]}")
+ Ohai::Log.debug("Plugin Network: link level default #{family} route, picking ip from #{network[gw_attr]}")
r = gw_if_ips.first
else
# checking network masks
r = gw_if_ips.select do |v|
network_contains_address(network[gw_attr], v[:ipaddress], v[:iface])
end.first
if r.nil?
r = gw_if_ips.first
- Ohai::Log.debug("[#{family}] no ipaddress/mask on #{network[int_attr]} matching the gateway #{network[gw_attr]}, picking #{r[:ipaddress]}")
+ Ohai::Log.debug("Plugin Network: [#{family}] no ipaddress/mask on #{network[int_attr]} matching the gateway #{network[gw_attr]}, picking #{r[:ipaddress]}")
else
- Ohai::Log.debug("[#{family}] Using default interface #{network[int_attr]} and default gateway #{network[gw_attr]} to set the default ip to #{r[:ipaddress]}")
+ Ohai::Log.debug("Plugin Network: [#{family}] Using default interface #{network[int_attr]} and default gateway #{network[gw_attr]} to set the default ip to #{r[:ipaddress]}")
end
end
else
# return the first ip address on network[int_attr]
r = gw_if_ips.first
end
else
r = ips.first
- Ohai::Log.debug("[#{family}] no default interface, picking the first ipaddress")
+ Ohai::Log.debug("Plugin Network: [#{family}] no default interface, picking the first ipaddress")
end
return [ nil, nil ] if r.nil? || r.empty?
[ r[:ipaddress].to_s, r[:iface] ]
@@ -147,37 +147,37 @@
(r["ip"], r["iface"]) = find_ip(family)
r["mac"] = find_mac_from_iface(r["iface"]) unless r["iface"].nil?
# don't overwrite attributes if they've already been set by the "#{os}::network" plugin
if (family == "inet") && ipaddress.nil?
if r["ip"].nil?
- Ohai::Log.warn("unable to detect ipaddress")
+ Ohai::Log.warn("Plugin Network: unable to detect ipaddress")
else
ipaddress r["ip"]
end
elsif (family == "inet6") && ip6address.nil?
if r["ip"].nil?
- Ohai::Log.debug("unable to detect ip6address")
+ Ohai::Log.debug("Plugin Network: unable to detect ip6address")
else
ip6address r["ip"]
end
end
# set the macaddress [only if we haven't already]. this allows the #{os}::network plugin to set macaddress
# otherwise we set macaddress on a first-found basis (and we started with ipv4)
if macaddress.nil?
if r["mac"]
- Ohai::Log.debug("setting macaddress to '#{r["mac"]}' from interface '#{r["iface"]}' for family '#{family}'")
+ Ohai::Log.debug("Plugin Network: setting macaddress to '#{r["mac"]}' from interface '#{r["iface"]}' for family '#{family}'")
macaddress r["mac"]
else
- Ohai::Log.debug("unable to detect macaddress for family '#{family}'")
+ Ohai::Log.debug("Plugin Network: unable to detect macaddress for family '#{family}'")
end
end
results[family] = r
end
if results["inet"]["iface"] && results["inet6"]["iface"] &&
(results["inet"]["iface"] != results["inet6"]["iface"])
- Ohai::Log.debug("ipaddress and ip6address are set from different interfaces (#{results["inet"]["iface"]} & #{results["inet6"]["iface"]})")
+ Ohai::Log.debug("Plugin Network: ipaddress and ip6address are set from different interfaces (#{results["inet"]["iface"]} & #{results["inet6"]["iface"]})")
end
end
end