summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTim Smith <tsmith84@gmail.com>2020-08-10 11:22:27 -0700
committerTim Smith <tsmith84@gmail.com>2020-08-10 11:22:27 -0700
commitf2dfd4a8f3b6bf4bce6cbd60ca228ff41cf2225e (patch)
treed5be36e946dfec50d5cd02b72fb8c820c6f9d913
parent23cf5e3f6ae625a13ce198076b01f8ed249ec20d (diff)
downloadohai-fix_require.tar.gz
Update network plugin to use ipaddr not ipaddress gemfix_require
This broke because we never actually required ipaddress in the plugin, but the specs passed because we required it there. Signed-off-by: Tim Smith <tsmith@chef.io>
-rw-r--r--lib/ohai/plugins/linux/network.rb4
-rw-r--r--spec/unit/plugins/linux/network_spec.rb1
2 files changed, 2 insertions, 3 deletions
diff --git a/lib/ohai/plugins/linux/network.rb b/lib/ohai/plugins/linux/network.rb
index b38df361..54523e11 100644
--- a/lib/ohai/plugins/linux/network.rb
+++ b/lib/ohai/plugins/linux/network.rb
@@ -518,8 +518,8 @@ Ohai.plugin(:Network) do
return false if default_route[:via].nil?
- dest_ipaddr = IPAddress(route[:destination])
- default_route_via = IPAddress(default_route[:via])
+ dest_ipaddr = IPAddr.new(route[:destination])
+ default_route_via = IPAddr.new(default_route[:via])
# check if nexthop is the same address family
return false if dest_ipaddr.ipv4? != default_route_via.ipv4?
diff --git a/spec/unit/plugins/linux/network_spec.rb b/spec/unit/plugins/linux/network_spec.rb
index 5ee364c0..978160bb 100644
--- a/spec/unit/plugins/linux/network_spec.rb
+++ b/spec/unit/plugins/linux/network_spec.rb
@@ -18,7 +18,6 @@
#
require "spec_helper"
-require "ipaddress" unless defined?(IPAddress)
describe Ohai::System, "Linux Network Plugin" do
let(:plugin) { get_plugin("linux/network") }