lib/ohai/plugins/network.rb in ohai-15.3.1 vs lib/ohai/plugins/network.rb in ohai-15.6.3
- old
+ new
@@ -16,12 +16,12 @@
# limitations under the License.
#
Ohai.plugin(:NetworkAddresses) do
require "ipaddress"
- require_relative "../mixin/network_constants"
- include Ohai::Mixin::NetworkConstants
+ require_relative "../mixin/network_helper"
+ include Ohai::Mixin::NetworkHelper
provides "ipaddress", "ip6address", "macaddress"
depends "network/interfaces"
@@ -67,12 +67,12 @@
# return if there aren't any #{family} addresses!
return [ nil, nil ] if ips.empty?
# shortcuts to access default #{family} interface and gateway
- int_attr = Ohai::Mixin::NetworkConstants::FAMILIES[family] + "_interface"
- gw_attr = Ohai::Mixin::NetworkConstants::FAMILIES[family] + "_gateway"
+ int_attr = Ohai::Mixin::NetworkHelper::FAMILIES[family] + "_interface"
+ gw_attr = Ohai::Mixin::NetworkHelper::FAMILIES[family] + "_gateway"
if network[int_attr]
# working with the address(es) of the default network interface
gw_if_ips = ips.select do |v|
v[:iface] == network[int_attr]
@@ -140,10 +140,10 @@
network[:interfaces] ||= Mash.new
counters Mash.new unless counters
counters[:network] ||= Mash.new
# inet family is processed before inet6 to give ipv4 precedence
- Ohai::Mixin::NetworkConstants::FAMILIES.keys.sort.each do |family|
+ Ohai::Mixin::NetworkHelper::FAMILIES.keys.sort.each do |family|
r = {}
# find the ip/interface with the default route for this family
(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