lib/ohai/plugins/network.rb in ohai-14.2.0 vs lib/ohai/plugins/network.rb in ohai-14.3.0

- old
+ new

@@ -34,16 +34,16 @@ scope_prio = [ "global", "site", "link", "host", "node", nil ] # grab ipaddress, scope, and iface for sorting later ipaddresses = [] Mash[network["interfaces"]].each do |iface, iface_v| - next if iface_v.nil? || !iface_v.has_key?("addresses") + next if iface_v.nil? || !iface_v.key?("addresses") iface_v["addresses"].each do |addr, addr_v| - next if addr_v.nil? || (not addr_v.has_key? "family") || addr_v["family"] != family + next if addr_v.nil? || (not addr_v.key? "family") || addr_v["family"] != family ipaddresses << { - :ipaddress => addr_v["prefixlen"] ? IPAddress("#{addr}/#{addr_v["prefixlen"]}") : IPAddress("#{addr}/#{addr_v["netmask"]}"), - :scope => addr_v["scope"].nil? ? nil : addr_v["scope"].downcase, - :iface => iface, + ipaddress: addr_v["prefixlen"] ? IPAddress("#{addr}/#{addr_v["prefixlen"]}") : IPAddress("#{addr}/#{addr_v["netmask"]}"), + scope: addr_v["scope"].nil? ? nil : addr_v["scope"].downcase, + iface: iface, } end end # sort ip addresses by scope, by prefixlen and then by ip address