diff options
author | Kris Shannon <k.shannon@amaze.com.au> | 2019-11-22 18:15:58 +1100 |
---|---|---|
committer | Kris Shannon <k.shannon@amaze.com.au> | 2019-11-22 18:15:58 +1100 |
commit | 964903716867f6a1a09f4c6a3b270ef331c856c7 (patch) | |
tree | 10be65440cb9e004edf0d403024fcc0191b61d71 | |
parent | cb9f1fa9b67674098e847a0f022a7eaaa448a2ea (diff) | |
download | ohai-964903716867f6a1a09f4c6a3b270ef331c856c7.tar.gz |
Rename Ohai::Mixin::NetworkConstants to NetworkHelper
This is in preparation for adding a helper method to the mixin for
converting ipv4 hex strings to dotted decimal
Signed-off-by: Kris Shannon <k.shannon@amaze.com.au>
-rw-r--r-- | lib/ohai/mixin/network_helper.rb (renamed from lib/ohai/mixin/network_constants.rb) | 2 | ||||
-rw-r--r-- | lib/ohai/plugins/network.rb | 10 |
2 files changed, 6 insertions, 6 deletions
diff --git a/lib/ohai/mixin/network_constants.rb b/lib/ohai/mixin/network_helper.rb index a10d78e4..b76f8033 100644 --- a/lib/ohai/mixin/network_constants.rb +++ b/lib/ohai/mixin/network_helper.rb @@ -19,7 +19,7 @@ module Ohai module Mixin - module NetworkConstants + module NetworkHelper FAMILIES = { "inet" => "default", "inet6" => "default_inet6", diff --git a/lib/ohai/plugins/network.rb b/lib/ohai/plugins/network.rb index af50d6d7..03003eb2 100644 --- a/lib/ohai/plugins/network.rb +++ b/lib/ohai/plugins/network.rb @@ -18,8 +18,8 @@ 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" @@ -69,8 +69,8 @@ Ohai.plugin(:NetworkAddresses) do 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 @@ -142,7 +142,7 @@ Ohai.plugin(:NetworkAddresses) do 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) |