summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLamont Granquist <lamont@scriptkiddie.org>2016-02-18 10:39:53 -0800
committerLamont Granquist <lamont@scriptkiddie.org>2016-02-18 10:39:53 -0800
commit4495af335d519c9ad5e02811927dd21fbaa0c9f2 (patch)
tree8993790bc496b0f8b20b74b93caf2dfb84a90350
parent0777d83eda29121c5ecf7b0b7f2049cb41c7b1e3 (diff)
parentd5696ca0a50dfa35d9015abd51da5908f57647f8 (diff)
downloadohai-4495af335d519c9ad5e02811927dd21fbaa0c9f2.tar.gz
Merge pull request #739 from chef/lcg/chefstyle2
Lcg/chefstyle2
-rw-r--r--lib/ohai/mixin/command.rb4
-rw-r--r--lib/ohai/plugins/aix/virtualization.rb6
-rw-r--r--lib/ohai/plugins/darwin/network.rb2
-rw-r--r--lib/ohai/plugins/linux/cpu.rb2
-rw-r--r--lib/ohai/plugins/linux/virtualization.rb2
-rw-r--r--lib/ohai/plugins/network.rb6
-rw-r--r--lib/ohai/plugins/network_listeners.rb4
-rw-r--r--lib/ohai/plugins/sigar/network.rb2
-rw-r--r--lib/ohai/plugins/sigar/network_route.rb2
-rw-r--r--lib/ohai/plugins/solaris2/cpu.rb2
-rw-r--r--lib/ohai/plugins/solaris2/dmi.rb2
-rw-r--r--lib/ohai/plugins/solaris2/zpools.rb2
-rw-r--r--lib/ohai/plugins/windows/network.rb2
-rw-r--r--lib/ohai/system.rb2
-rw-r--r--platform_simulation_specs/common/ohai_plugin_common.rb4
-rw-r--r--spec/unit/plugins/darwin/kernel_spec.rb6
-rw-r--r--spec/unit/plugins/dmi_spec.rb6
-rw-r--r--spec/unit/plugins/linux/network_spec.rb492
-rw-r--r--spec/unit/plugins/solaris2/kernel_spec.rb2
-rw-r--r--spec/unit/plugins/windows/cpu_spec.rb2
20 files changed, 275 insertions, 277 deletions
diff --git a/lib/ohai/mixin/command.rb b/lib/ohai/mixin/command.rb
index b76fa3ef..69c1c095 100644
--- a/lib/ohai/mixin/command.rb
+++ b/lib/ohai/mixin/command.rb
@@ -37,7 +37,7 @@ module Ohai
module_function :shell_out
def run_command(args = {})
- Ohai::Log.warn('Ohai::Mixin::Command run_command is deprecated and will be removed in Ohai 9.0.0')
+ Ohai::Log.warn("Ohai::Mixin::Command run_command is deprecated and will be removed in Ohai 9.0.0")
if args.has_key?(:creates)
if File.exists?(args[:creates])
Ohai::Log.debug("Skipping #{args[:command]} - creates #{args[:creates]} exists.")
@@ -125,7 +125,7 @@ module Ohai
#
# Thanks Ara!
def popen4(cmd, args = {}, &b)
- Ohai::Log.warn('Ohai::Mixin::Command popen4 is deprecated and will be removed in Ohai 9.0.0')
+ Ohai::Log.warn("Ohai::Mixin::Command popen4 is deprecated and will be removed in Ohai 9.0.0")
# Disable garbage collection to work around possible bug in MRI
# Ruby 1.8 suffers from intermittent segfaults believed to be due to GC while IO.select
diff --git a/lib/ohai/plugins/aix/virtualization.rb b/lib/ohai/plugins/aix/virtualization.rb
index fdce73ef..9271323a 100644
--- a/lib/ohai/plugins/aix/virtualization.rb
+++ b/lib/ohai/plugins/aix/virtualization.rb
@@ -82,8 +82,8 @@ Ohai.plugin(:Virtualization) do
value = {
"mountpoint" => splat[0],
"device" => splat[1],
- "vfs" => splat[2],
- "options" => splat[3].split(","),
+ "vfs" => splat[2],
+ "options" => splat[3].split(","),
}
wpars[wpar_name][title][key] = value
when "security settings"
@@ -103,7 +103,7 @@ Ohai.plugin(:Virtualization) do
key = splat[0].downcase
value = {
"type" => splat[1],
- "status" => splat[2],
+ "status" => splat[2],
}
wpars[wpar_name][title][key] = value
else
diff --git a/lib/ohai/plugins/darwin/network.rb b/lib/ohai/plugins/darwin/network.rb
index 52febfce..164ecbb6 100644
--- a/lib/ohai/plugins/darwin/network.rb
+++ b/lib/ohai/plugins/darwin/network.rb
@@ -185,7 +185,7 @@ Ohai.plugin(:Network) do
so = shell_out("netstat -i -d -l -b -n")
so.stdout.lines do |line|
if line =~ /^([a-zA-Z0-9\.\:\-\*]+)\s+\d+\s+\<[a-zA-Z0-9\#]+\>\s+([a-f0-9\:]+)\s+(\d+)\s+(\d+)\s+(\d+)\s+(\d+)\s+(\d+)\s+(\d+)\s+(\d+)/ ||
- line =~ /^([a-zA-Z0-9\.\:\-\*]+)\s+\d+\s+\<[a-zA-Z0-9\#]+\>(\s+)(\d+)\s+(\d+)\s+(\d+)\s+(\d+)\s+(\d+)\s+(\d+)\s+(\d+)/
+ line =~ /^([a-zA-Z0-9\.\:\-\*]+)\s+\d+\s+\<[a-zA-Z0-9\#]+\>(\s+)(\d+)\s+(\d+)\s+(\d+)\s+(\d+)\s+(\d+)\s+(\d+)\s+(\d+)/
ifname = locate_interface(iface, $1, $2)
next if iface[ifname].nil? # this shouldn't happen, but just in case
net_counters[ifname] = Mash.new unless net_counters[ifname]
diff --git a/lib/ohai/plugins/linux/cpu.rb b/lib/ohai/plugins/linux/cpu.rb
index 9b9e0b72..287e8def 100644
--- a/lib/ohai/plugins/linux/cpu.rb
+++ b/lib/ohai/plugins/linux/cpu.rb
@@ -68,7 +68,7 @@ Ohai.plugin(:CPU) do
cpu_number += 1
cpuinfo[current_cpu] = Mash.new
current_cpu_info = $2.split(",")
- for i in current_cpu_info
+ current_cpu_info.each do |i|
name_value = i.split("=")
name = name_value[0].strip
value = name_value[1].strip
diff --git a/lib/ohai/plugins/linux/virtualization.rb b/lib/ohai/plugins/linux/virtualization.rb
index d681bc5d..ae559b58 100644
--- a/lib/ohai/plugins/linux/virtualization.rb
+++ b/lib/ohai/plugins/linux/virtualization.rb
@@ -163,7 +163,7 @@ Ohai.plugin(:Virtualization) do
if File.exist?("/proc/self/cgroup")
cgroup_content = File.read("/proc/self/cgroup")
if cgroup_content =~ %r{^\d+:[^:]+:/(lxc|docker)/.+$} ||
- cgroup_content =~ %r{^\d+:[^:]+:/[^/]+/(lxc|docker)-.+$}
+ cgroup_content =~ %r{^\d+:[^:]+:/[^/]+/(lxc|docker)-.+$}
virtualization[:system] = $1
virtualization[:role] = "guest"
virtualization[:systems][$1.to_sym] = "guest"
diff --git a/lib/ohai/plugins/network.rb b/lib/ohai/plugins/network.rb
index caa3e840..e33b2d9d 100644
--- a/lib/ohai/plugins/network.rb
+++ b/lib/ohai/plugins/network.rb
@@ -79,8 +79,8 @@ Ohai.plugin(:NetworkAddresses) do
if gw_if_ips.empty?
Ohai::Log.warn("[#{family}] no ip address on #{network[int_attr]}")
elsif network[gw_attr] &&
- network["interfaces"][network[int_attr]] &&
- network["interfaces"][network[int_attr]]["addresses"]
+ 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]}")
@@ -176,7 +176,7 @@ Ohai.plugin(:NetworkAddresses) do
end
if results["inet"]["iface"] && results["inet6"]["iface"] &&
- (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"]})")
end
end
diff --git a/lib/ohai/plugins/network_listeners.rb b/lib/ohai/plugins/network_listeners.rb
index 62661c77..292378d7 100644
--- a/lib/ohai/plugins/network_listeners.rb
+++ b/lib/ohai/plugins/network_listeners.rb
@@ -23,7 +23,7 @@ Ohai.plugin(:NetworkListeners) do
collect_data do
begin
- require 'sigar'
+ require "sigar"
flags = Sigar::NETCONN_TCP | Sigar::NETCONN_SERVER
network Mash.new unless network
@@ -54,7 +54,7 @@ Ohai.plugin(:NetworkListeners) do
network[:listeners] = Mash.new
network[:listeners][:tcp] = listeners
rescue LoadError
- Ohai::Log.debug('Could not load sigar gem. Skipping NetworkListeners plugin')
+ Ohai::Log.debug("Could not load sigar gem. Skipping NetworkListeners plugin")
end
end
end
diff --git a/lib/ohai/plugins/sigar/network.rb b/lib/ohai/plugins/sigar/network.rb
index d5bfa52d..b5645060 100644
--- a/lib/ohai/plugins/sigar/network.rb
+++ b/lib/ohai/plugins/sigar/network.rb
@@ -58,7 +58,7 @@ Ohai.plugin(:Network) do
iface[cint][:addresses][ifconfig.address] = { "family" => "inet" }
# Backwards compat: no broadcast on tunnel or loopback dev
if ((ifconfig.flags & Sigar::IFF_POINTOPOINT) == 0) &&
- ((ifconfig.flags & Sigar::IFF_LOOPBACK) == 0)
+ ((ifconfig.flags & Sigar::IFF_LOOPBACK) == 0)
iface[cint][:addresses][ifconfig.address]["broadcast"] = ifconfig.broadcast
end
iface[cint][:addresses][ifconfig.address]["netmask"] = ifconfig.netmask
diff --git a/lib/ohai/plugins/sigar/network_route.rb b/lib/ohai/plugins/sigar/network_route.rb
index f4d3161f..4d191e9f 100644
--- a/lib/ohai/plugins/sigar/network_route.rb
+++ b/lib/ohai/plugins/sigar/network_route.rb
@@ -59,6 +59,6 @@ Ohai.plugin(:NetworkRoutes) do
end
end
rescue LoadError
- Ohai::Log.debug('Could not load sigar gem. Skipping NetworkRoutes plugin')
+ Ohai::Log.debug("Could not load sigar gem. Skipping NetworkRoutes plugin")
end
end
diff --git a/lib/ohai/plugins/solaris2/cpu.rb b/lib/ohai/plugins/solaris2/cpu.rb
index 4a60318e..52b8941e 100644
--- a/lib/ohai/plugins/solaris2/cpu.rb
+++ b/lib/ohai/plugins/solaris2/cpu.rb
@@ -33,7 +33,7 @@ Ohai.plugin(:CPU) do
processor_info.each_with_index do |processor, i|
desc, instance, record, keyvalue = processor.split(":")
cpu[instance] ||= Mash.new
- if (currentcpu != instance)
+ if currentcpu != instance
cpu["total"] += 1
currentcpu = instance
end
diff --git a/lib/ohai/plugins/solaris2/dmi.rb b/lib/ohai/plugins/solaris2/dmi.rb
index f4d8cc3c..96e57b15 100644
--- a/lib/ohai/plugins/solaris2/dmi.rb
+++ b/lib/ohai/plugins/solaris2/dmi.rb
@@ -117,7 +117,7 @@ Ohai.plugin(:DMI) do
# remove/replace any characters that don't fall inside permissible ASCII range, or whitespace
line = raw_line.gsub(/[^\x20-\x7E\n\t\r]/, ".")
- if (line != raw_line)
+ if line != raw_line
Ohai::Log.debug("converted characters from line:\n#{raw_line}")
end
diff --git a/lib/ohai/plugins/solaris2/zpools.rb b/lib/ohai/plugins/solaris2/zpools.rb
index 94f0a3ac..9356c29c 100644
--- a/lib/ohai/plugins/solaris2/zpools.rb
+++ b/lib/ohai/plugins/solaris2/zpools.rb
@@ -39,7 +39,7 @@ Ohai.plugin(:Zpools) do
end
# Grab individual health for devices in the zpools
- for pool in pools.keys
+ pools.keys.each do |pool|
pools[pool][:devices] = Mash.new
# Run "zpool status" as non-root user (adm) so that
# the command won't try to open() each device which can
diff --git a/lib/ohai/plugins/windows/network.rb b/lib/ohai/plugins/windows/network.rb
index 65d76cd1..37f92fdc 100644
--- a/lib/ohai/plugins/windows/network.rb
+++ b/lib/ohai/plugins/windows/network.rb
@@ -96,7 +96,7 @@ Ohai.plugin(:Network) do
# Apparently you can have more than one mac_address? Odd.
[iface[cint][:configuration][:mac_address]].flatten.each do |mac_addr|
iface[cint][:addresses][mac_addr] = {
- "family" => "lladdr"
+ "family" => "lladdr"
}
end
iface[cint][:mtu] = iface[cint][:configuration][:mtu]
diff --git a/lib/ohai/system.rb b/lib/ohai/system.rb
index c36ac7f6..4a09966c 100644
--- a/lib/ohai/system.rb
+++ b/lib/ohai/system.rb
@@ -212,7 +212,7 @@ module Ohai
Ohai.config.merge!(@config)
if Ohai.config[:directory] &&
- !Ohai.config[:plugin_path].include?(Ohai.config[:directory])
+ !Ohai.config[:plugin_path].include?(Ohai.config[:directory])
Ohai.config[:plugin_path] << Ohai.config[:directory]
end
end
diff --git a/platform_simulation_specs/common/ohai_plugin_common.rb b/platform_simulation_specs/common/ohai_plugin_common.rb
index 78dbc90f..229272c7 100644
--- a/platform_simulation_specs/common/ohai_plugin_common.rb
+++ b/platform_simulation_specs/common/ohai_plugin_common.rb
@@ -32,7 +32,7 @@ module OhaiPluginCommon
# env = JSON.load(env)
- argv = ARGV.map { |arg| if /\ / =~ arg then "\"" + arg + "\"" else arg end }.join " "
+ argv = ARGV.map { |arg| ( /\ / =~ arg ) ? "\"" + arg + "\"" : arg }.join " "
match = data[platform][arch].select { |v| v[:params] == argv && v[:env] == env }
raise "No canned output for these settings." if match.empty?
@@ -199,7 +199,7 @@ def test_plugin(plugin_names, cmd_list)
return
# clean the path directory, in case a previous test was interrupted
- OhaiPluginCommon.clean_path OhaiPluginCommon.get_path, /^.*\.rb$/
+ OhaiPluginCommon.clean_path OhaiPluginCommon.get_path, /^.*\.rb$/ # rubocop:disable Lint/UnreachableCode
l = lambda do |*args|
platforms = args[0]
diff --git a/spec/unit/plugins/darwin/kernel_spec.rb b/spec/unit/plugins/darwin/kernel_spec.rb
index 092beba0..54cdb7b4 100644
--- a/spec/unit/plugins/darwin/kernel_spec.rb
+++ b/spec/unit/plugins/darwin/kernel_spec.rb
@@ -34,9 +34,9 @@ describe Ohai::System, "Darwin kernel plugin" do
EOF
modules = {
- "com.apple.kec.corecrypto" => { "version" => "1.0", "size" => 266240, "index" => "8", "refcount" => "0" },
- "com.apple.iokit.IOACPIFamily" => { "version" => "1.4", "size" => 36864, "index" => "9", "refcount" => "22" },
- "com.apple.iokit.IOPCIFamily" => { "version" => "2.8", "size" => 167936, "index" => "10", "refcount" => "30" } }
+ "com.apple.kec.corecrypto" => { "version" => "1.0", "size" => 266240, "index" => "8", "refcount" => "0" },
+ "com.apple.iokit.IOACPIFamily" => { "version" => "1.4", "size" => 36864, "index" => "9", "refcount" => "22" },
+ "com.apple.iokit.IOPCIFamily" => { "version" => "2.8", "size" => 167936, "index" => "10", "refcount" => "30" } }
@plugin.run
expect(@plugin[:kernel][:modules]).to eql(modules)
diff --git a/spec/unit/plugins/dmi_spec.rb b/spec/unit/plugins/dmi_spec.rb
index a97c5ea6..6e8c0d41 100644
--- a/spec/unit/plugins/dmi_spec.rb
+++ b/spec/unit/plugins/dmi_spec.rb
@@ -6,9 +6,9 @@
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
-#
+#
# http://www.apache.org/licenses/LICENSE-2.0
-#
+#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -16,7 +16,7 @@
# limitations under the License.
#
-require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper.rb')
+require File.expand_path(File.dirname(__FILE__) + "/../../spec_helper.rb")
# NOTE: These data lines must be prefixed with one or two tabs, not spaces.
DMI_OUT = <<-EOS
diff --git a/spec/unit/plugins/linux/network_spec.rb b/spec/unit/plugins/linux/network_spec.rb
index b6f6a615..213d0e2d 100644
--- a/spec/unit/plugins/linux/network_spec.rb
+++ b/spec/unit/plugins/linux/network_spec.rb
@@ -17,10 +17,10 @@
# limitations under the License.
#
-require File.expand_path(File.dirname(__FILE__) + '/../../../spec_helper.rb')
+require File.expand_path(File.dirname(__FILE__) + "/../../../spec_helper.rb")
begin
- require 'ipaddress'
+ require "ipaddress"
rescue LoadError => e
puts "The linux network plugin spec tests will fail without the 'ipaddress' library/gem.\n\n"
raise e
@@ -29,8 +29,8 @@ end
describe Ohai::System, "Linux Network Plugin" do
let(:plugin) { get_plugin("linux/network") }
- let(:linux_ifconfig) {
-'eth0 Link encap:Ethernet HWaddr 12:31:3D:02:BE:A2
+ let(:linux_ifconfig) { <<-EOM
+eth0 Link encap:Ethernet HWaddr 12:31:3D:02:BE:A2
inet addr:10.116.201.76 Bcast:10.116.201.255 Mask:255.255.255.0
inet6 addr: fe80::1031:3dff:fe02:bea2/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
@@ -138,41 +138,41 @@ xapi1 Link encap:Ethernet HWaddr E8:39:35:C5:C8:50
TX packets:6 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:21515031 (20.5 MiB) TX bytes:2052 (2.0 KiB)
-'
+EOM
# Note that ifconfig shows foo:veth0@eth0 but fails to show any address information.
# This was not a mistake collecting the output and Apparently ifconfig is broken in this regard.
}
- let(:linux_ip_route) {
-'10.116.201.0/24 dev eth0 proto kernel
+ let(:linux_ip_route) { <<-EOM
+10.116.201.0/24 dev eth0 proto kernel
192.168.5.0/24 dev eth0 proto kernel src 192.168.5.1
192.168.212.0/24 dev foo:veth0@eth0 proto kernel src 192.168.212.2
172.16.151.0/24 dev eth0 proto kernel src 172.16.151.100
192.168.0.0/24 dev eth0 proto kernel src 192.168.0.2
10.5.4.0/24 \\ nexthop via 10.5.4.1 dev eth0 weight 1\\ nexthop via 10.5.4.2 dev eth0 weight 1
default via 10.116.201.1 dev eth0
-'
+EOM
}
- let(:linux_route_n) {
-'Kernel IP routing table
+ let(:linux_route_n) { <<-EOM
+Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
10.116.201.0 0.0.0.0 255.255.255.0 U 0 0 0 eth0
169.254.0.0 0.0.0.0 255.255.0.0 U 1002 0 0 eth0
0.0.0.0 10.116.201.1 0.0.0.0 UG 0 0 0 eth0
-'
+EOM
}
- let(:linux_ip_route_inet6) {
-'fe80::/64 dev eth0 proto kernel metric 256
+ let(:linux_ip_route_inet6) { <<-EOM
+fe80::/64 dev eth0 proto kernel metric 256
fe80::/64 dev eth0.11 proto kernel metric 256
1111:2222:3333:4444::/64 dev eth0.11 metric 1024 expires 86023sec
default via 1111:2222:3333:4444::1 dev eth0.11 metric 1024
-'
+EOM
}
- let(:linux_ip_addr) {
-'1: lo: <LOOPBACK,UP,LOWER_UP> mtu 16436 qdisc noqueue state UNKNOWN
+ let(:linux_ip_addr) { <<-EOM
+1: lo: <LOOPBACK,UP,LOWER_UP> mtu 16436 qdisc noqueue state UNKNOWN
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
inet 127.0.0.1/8 scope host lo
inet6 ::1/128 scope host
@@ -225,11 +225,11 @@ default via 1111:2222:3333:4444::1 dev eth0.11 metric 1024
link/ether e8:39:35:c5:c8:50 brd ff:ff:ff:ff:ff:ff
inet 192.168.13.34/24 brd 192.168.13.255 scope global xapi1
valid_lft forever preferred_lft forever
-'
+EOM
}
- let(:linux_ip_link_s_d) {
-'1: lo: <LOOPBACK,UP,LOWER_UP> mtu 16436 qdisc noqueue state UNKNOWN
+ let(:linux_ip_link_s_d) { <<-EOM
+1: lo: <LOOPBACK,UP,LOWER_UP> mtu 16436 qdisc noqueue state UNKNOWN
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
RX: bytes packets errors dropped overrun mcast
35224 524 0 0 0 0
@@ -278,28 +278,28 @@ default via 1111:2222:3333:4444::1 dev eth0.11 metric 1024
21468183 159866 0 0 0 0
TX: bytes packets errors dropped carrier collsns
2052 6 0 0 0 0
-'
+EOM
}
- let(:linux_arp_an) {
-'? (10.116.201.1) at fe:ff:ff:ff:ff:ff [ether] on eth0
-'
+ let(:linux_arp_an) { <<-EOM
+? (10.116.201.1) at fe:ff:ff:ff:ff:ff [ether] on eth0
+EOM
}
- let(:linux_ip_neighbor_show) {
-'10.116.201.1 dev eth0 lladdr fe:ff:ff:ff:ff:ff REACHABLE
-'
+ let(:linux_ip_neighbor_show) { <<-EOM
+10.116.201.1 dev eth0 lladdr fe:ff:ff:ff:ff:ff REACHABLE
+EOM
}
- let(:linux_ip_inet6_neighbor_show) {
-'1111:2222:3333:4444::1 dev eth0.11 lladdr 00:1c:0e:12:34:56 router REACHABLE
+ let(:linux_ip_inet6_neighbor_show) { <<-EOM
+1111:2222:3333:4444::1 dev eth0.11 lladdr 00:1c:0e:12:34:56 router REACHABLE
fe80::21c:eff:fe12:3456 dev eth0.11 lladdr 00:1c:0e:30:28:00 router REACHABLE
fe80::21c:eff:fe12:3456 dev eth0.153 lladdr 00:1c:0e:30:28:00 router REACHABLE
-'
+EOM
}
- let(:linux_ethtool) {
-'Settings for eth0:
+ let(:linux_ethtool) { <<-EOM
+Settings for eth0:
Supported ports: [ FIBRE ]
Supported link modes: 1000baseT/Full
10000baseT/Full
@@ -320,7 +320,7 @@ fe80::21c:eff:fe12:3456 dev eth0.153 lladdr 00:1c:0e:30:28:00 router REACHABLE
Current message level: 0x00000007 (7)
drv probe link
Link detected: yes
-'
+EOM
}
before(:each) do
@@ -359,121 +359,119 @@ fe80::21c:eff:fe12:3456 dev eth0.153 lladdr 00:1c:0e:30:28:00 router REACHABLE
end
end
-
- ["ifconfig","iproute2"].each do |network_method|
+ %w{ifconfig iproute2}.each do |network_method|
describe "gathering IP layer address info via #{network_method}" do
before(:each) do
allow(plugin).to receive(:iproute2_binary_available?).and_return( network_method == "iproute2" )
- allow(plugin).to receive(:find_ethtool_binary).and_return( '/sbin/ethtool' )
+ allow(plugin).to receive(:find_ethtool_binary).and_return( "/sbin/ethtool" )
plugin.run
end
it "completes the run" do
expect(Ohai::Log).not_to receive(:debug).with(/Plugin linux::network threw exception/)
- expect(plugin['network']).not_to be_nil
+ expect(plugin["network"]).not_to be_nil
end
it "detects the interfaces" do
- expect(plugin['network']['interfaces'].keys.sort).to eq(["eth0", "eth0.11", "eth0.151", "eth0.152", "eth0.153", "eth0:5", "eth3", "foo:veth0@eth0", "lo", "ovs-system", "tun0", "venet0", "venet0:0", "xapi1"])
+ expect(plugin["network"]["interfaces"].keys.sort).to eq(["eth0", "eth0.11", "eth0.151", "eth0.152", "eth0.153", "eth0:5", "eth3", "foo:veth0@eth0", "lo", "ovs-system", "tun0", "venet0", "venet0:0", "xapi1"])
end
it "detects the layer one details of an ethernet interface" do
- expect(plugin['network']['interfaces']['eth0']['link_speed']).to eq(10000)
- expect(plugin['network']['interfaces']['eth0']['duplex']).to eq('Full')
- expect(plugin['network']['interfaces']['eth0']['port']).to eq('FIBRE')
- expect(plugin['network']['interfaces']['eth0']['transceiver']).to eq('external')
- expect(plugin['network']['interfaces']['eth0']['auto_negotiation']).to eq('on')
- expect(plugin['network']['interfaces']['eth0']['mdi_x']).to be_nil
+ expect(plugin["network"]["interfaces"]["eth0"]["link_speed"]).to eq(10000)
+ expect(plugin["network"]["interfaces"]["eth0"]["duplex"]).to eq("Full")
+ expect(plugin["network"]["interfaces"]["eth0"]["port"]).to eq("FIBRE")
+ expect(plugin["network"]["interfaces"]["eth0"]["transceiver"]).to eq("external")
+ expect(plugin["network"]["interfaces"]["eth0"]["auto_negotiation"]).to eq("on")
+ expect(plugin["network"]["interfaces"]["eth0"]["mdi_x"]).to be_nil
end
it "detects the ipv4 addresses of the ethernet interface" do
- expect(plugin['network']['interfaces']['eth0']['addresses'].keys).to include('10.116.201.76')
- expect(plugin['network']['interfaces']['eth0']['addresses']['10.116.201.76']['netmask']).to eq('255.255.255.0')
- expect(plugin['network']['interfaces']['eth0']['addresses']['10.116.201.76']['broadcast']).to eq('10.116.201.255')
- expect(plugin['network']['interfaces']['eth0']['addresses']['10.116.201.76']['family']).to eq('inet')
+ expect(plugin["network"]["interfaces"]["eth0"]["addresses"].keys).to include("10.116.201.76")
+ expect(plugin["network"]["interfaces"]["eth0"]["addresses"]["10.116.201.76"]["netmask"]).to eq("255.255.255.0")
+ expect(plugin["network"]["interfaces"]["eth0"]["addresses"]["10.116.201.76"]["broadcast"]).to eq("10.116.201.255")
+ expect(plugin["network"]["interfaces"]["eth0"]["addresses"]["10.116.201.76"]["family"]).to eq("inet")
end
it "detects the ipv4 addresses of an ethernet subinterface" do
- expect(plugin['network']['interfaces']['eth0.11']['addresses'].keys).to include('192.168.0.16')
- expect(plugin['network']['interfaces']['eth0.11']['addresses']['192.168.0.16']['netmask']).to eq('255.255.255.0')
- expect(plugin['network']['interfaces']['eth0.11']['addresses']['192.168.0.16']['broadcast']).to eq('192.168.0.255')
- expect(plugin['network']['interfaces']['eth0.11']['addresses']['192.168.0.16']['family']).to eq('inet')
+ expect(plugin["network"]["interfaces"]["eth0.11"]["addresses"].keys).to include("192.168.0.16")
+ expect(plugin["network"]["interfaces"]["eth0.11"]["addresses"]["192.168.0.16"]["netmask"]).to eq("255.255.255.0")
+ expect(plugin["network"]["interfaces"]["eth0.11"]["addresses"]["192.168.0.16"]["broadcast"]).to eq("192.168.0.255")
+ expect(plugin["network"]["interfaces"]["eth0.11"]["addresses"]["192.168.0.16"]["family"]).to eq("inet")
end
it "detects the ipv6 addresses of the ethernet interface" do
- expect(plugin['network']['interfaces']['eth0']['addresses'].keys).to include('fe80::1031:3dff:fe02:bea2')
- expect(plugin['network']['interfaces']['eth0']['addresses']['fe80::1031:3dff:fe02:bea2']['scope']).to eq('Link')
- expect(plugin['network']['interfaces']['eth0']['addresses']['fe80::1031:3dff:fe02:bea2']['prefixlen']).to eq('64')
- expect(plugin['network']['interfaces']['eth0']['addresses']['fe80::1031:3dff:fe02:bea2']['family']).to eq('inet6')
+ expect(plugin["network"]["interfaces"]["eth0"]["addresses"].keys).to include("fe80::1031:3dff:fe02:bea2")
+ expect(plugin["network"]["interfaces"]["eth0"]["addresses"]["fe80::1031:3dff:fe02:bea2"]["scope"]).to eq("Link")
+ expect(plugin["network"]["interfaces"]["eth0"]["addresses"]["fe80::1031:3dff:fe02:bea2"]["prefixlen"]).to eq("64")
+ expect(plugin["network"]["interfaces"]["eth0"]["addresses"]["fe80::1031:3dff:fe02:bea2"]["family"]).to eq("inet6")
end
it "detects the ipv6 addresses of an ethernet subinterface" do
- %w[ 1111:2222:3333:4444::2 1111:2222:3333:4444::3 ].each do |addr|
- expect(plugin['network']['interfaces']['eth0.11']['addresses'].keys).to include(addr)
- expect(plugin['network']['interfaces']['eth0.11']['addresses'][addr]['scope']).to eq('Global')
- expect(plugin['network']['interfaces']['eth0.11']['addresses'][addr]['prefixlen']).to eq('64')
- expect(plugin['network']['interfaces']['eth0.11']['addresses'][addr]['family']).to eq('inet6')
+ %w{ 1111:2222:3333:4444::2 1111:2222:3333:4444::3 }.each do |addr|
+ expect(plugin["network"]["interfaces"]["eth0.11"]["addresses"].keys).to include(addr)
+ expect(plugin["network"]["interfaces"]["eth0.11"]["addresses"][addr]["scope"]).to eq("Global")
+ expect(plugin["network"]["interfaces"]["eth0.11"]["addresses"][addr]["prefixlen"]).to eq("64")
+ expect(plugin["network"]["interfaces"]["eth0.11"]["addresses"][addr]["family"]).to eq("inet6")
end
end
it "detects the mac addresses of the ethernet interface" do
- expect(plugin['network']['interfaces']['eth0']['addresses'].keys).to include('12:31:3D:02:BE:A2')
- expect(plugin['network']['interfaces']['eth0']['addresses']['12:31:3D:02:BE:A2']['family']).to eq('lladdr')
+ expect(plugin["network"]["interfaces"]["eth0"]["addresses"].keys).to include("12:31:3D:02:BE:A2")
+ expect(plugin["network"]["interfaces"]["eth0"]["addresses"]["12:31:3D:02:BE:A2"]["family"]).to eq("lladdr")
end
it "detects the encapsulation type of the ethernet interface" do
- expect(plugin['network']['interfaces']['eth0']['encapsulation']).to eq('Ethernet')
+ expect(plugin["network"]["interfaces"]["eth0"]["encapsulation"]).to eq("Ethernet")
end
it "detects the flags of the ethernet interface" do
if network_method == "ifconfig"
- expect(plugin['network']['interfaces']['eth0']['flags'].sort).to eq(['BROADCAST','MULTICAST','RUNNING','UP'])
+ expect(plugin["network"]["interfaces"]["eth0"]["flags"].sort).to eq(%w{BROADCAST MULTICAST RUNNING UP})
else
- expect(plugin['network']['interfaces']['eth0']['flags'].sort).to eq(['BROADCAST','LOWER_UP','MULTICAST','UP'])
+ expect(plugin["network"]["interfaces"]["eth0"]["flags"].sort).to eq(%w{BROADCAST LOWER_UP MULTICAST UP})
end
end
it "detects the number of the ethernet interface" do
- expect(plugin['network']['interfaces']['eth0']['number']).to eq("0")
+ expect(plugin["network"]["interfaces"]["eth0"]["number"]).to eq("0")
end
it "detects the mtu of the ethernet interface" do
- expect(plugin['network']['interfaces']['eth0']['mtu']).to eq("1500")
+ expect(plugin["network"]["interfaces"]["eth0"]["mtu"]).to eq("1500")
end
it "detects the ipv4 addresses of the loopback interface" do
- expect(plugin['network']['interfaces']['lo']['addresses'].keys).to include('127.0.0.1')
- expect(plugin['network']['interfaces']['lo']['addresses']['127.0.0.1']['netmask']).to eq('255.0.0.0')
- expect(plugin['network']['interfaces']['lo']['addresses']['127.0.0.1']['family']).to eq('inet')
+ expect(plugin["network"]["interfaces"]["lo"]["addresses"].keys).to include("127.0.0.1")
+ expect(plugin["network"]["interfaces"]["lo"]["addresses"]["127.0.0.1"]["netmask"]).to eq("255.0.0.0")
+ expect(plugin["network"]["interfaces"]["lo"]["addresses"]["127.0.0.1"]["family"]).to eq("inet")
end
it "detects the ipv6 addresses of the loopback interface" do
- expect(plugin['network']['interfaces']['lo']['addresses'].keys).to include('::1')
- expect(plugin['network']['interfaces']['lo']['addresses']['::1']['scope']).to eq('Node')
- expect(plugin['network']['interfaces']['lo']['addresses']['::1']['prefixlen']).to eq('128')
- expect(plugin['network']['interfaces']['lo']['addresses']['::1']['family']).to eq('inet6')
+ expect(plugin["network"]["interfaces"]["lo"]["addresses"].keys).to include("::1")
+ expect(plugin["network"]["interfaces"]["lo"]["addresses"]["::1"]["scope"]).to eq("Node")
+ expect(plugin["network"]["interfaces"]["lo"]["addresses"]["::1"]["prefixlen"]).to eq("128")
+ expect(plugin["network"]["interfaces"]["lo"]["addresses"]["::1"]["family"]).to eq("inet6")
end
it "detects the encapsulation type of the loopback interface" do
- expect(plugin['network']['interfaces']['lo']['encapsulation']).to eq('Loopback')
+ expect(plugin["network"]["interfaces"]["lo"]["encapsulation"]).to eq("Loopback")
end
it "detects the flags of the ethernet interface" do
if network_method == "ifconfig"
- expect(plugin['network']['interfaces']['lo']['flags'].sort).to eq(['LOOPBACK','RUNNING','UP'])
+ expect(plugin["network"]["interfaces"]["lo"]["flags"].sort).to eq(%w{LOOPBACK RUNNING UP})
else
- expect(plugin['network']['interfaces']['lo']['flags'].sort).to eq(['LOOPBACK','LOWER_UP','UP'])
+ expect(plugin["network"]["interfaces"]["lo"]["flags"].sort).to eq(%w{LOOPBACK LOWER_UP UP})
end
end
-
it "detects the mtu of the loopback interface" do
- expect(plugin['network']['interfaces']['lo']['mtu']).to eq("16436")
+ expect(plugin["network"]["interfaces"]["lo"]["mtu"]).to eq("16436")
end
it "detects the arp entries" do
- expect(plugin['network']['interfaces']['eth0']['arp']['10.116.201.1']).to eq('fe:ff:ff:ff:ff:ff')
+ expect(plugin["network"]["interfaces"]["eth0"]["arp"]["10.116.201.1"]).to eq("fe:ff:ff:ff:ff:ff")
end
end
@@ -485,34 +483,34 @@ fe80::21c:eff:fe12:3456 dev eth0.153 lladdr 00:1c:0e:30:28:00 router REACHABLE
end
it "detects the ethernet counters" do
- expect(plugin['counters']['network']['interfaces']['eth0']['tx']['bytes']).to eq("691785313")
- expect(plugin['counters']['network']['interfaces']['eth0']['tx']['packets']).to eq("1919690")
- expect(plugin['counters']['network']['interfaces']['eth0']['tx']['collisions']).to eq("0")
- expect(plugin['counters']['network']['interfaces']['eth0']['tx']['queuelen']).to eq("1000")
- expect(plugin['counters']['network']['interfaces']['eth0']['tx']['errors']).to eq("0")
- expect(plugin['counters']['network']['interfaces']['eth0']['tx']['carrier']).to eq("0")
- expect(plugin['counters']['network']['interfaces']['eth0']['tx']['drop']).to eq("0")
-
- expect(plugin['counters']['network']['interfaces']['eth0']['rx']['bytes']).to eq("1392844460")
- expect(plugin['counters']['network']['interfaces']['eth0']['rx']['packets']).to eq("2659966")
- expect(plugin['counters']['network']['interfaces']['eth0']['rx']['errors']).to eq("0")
- expect(plugin['counters']['network']['interfaces']['eth0']['rx']['overrun']).to eq("0")
- expect(plugin['counters']['network']['interfaces']['eth0']['rx']['drop']).to eq("0")
+ expect(plugin["counters"]["network"]["interfaces"]["eth0"]["tx"]["bytes"]).to eq("691785313")
+ expect(plugin["counters"]["network"]["interfaces"]["eth0"]["tx"]["packets"]).to eq("1919690")
+ expect(plugin["counters"]["network"]["interfaces"]["eth0"]["tx"]["collisions"]).to eq("0")
+ expect(plugin["counters"]["network"]["interfaces"]["eth0"]["tx"]["queuelen"]).to eq("1000")
+ expect(plugin["counters"]["network"]["interfaces"]["eth0"]["tx"]["errors"]).to eq("0")
+ expect(plugin["counters"]["network"]["interfaces"]["eth0"]["tx"]["carrier"]).to eq("0")
+ expect(plugin["counters"]["network"]["interfaces"]["eth0"]["tx"]["drop"]).to eq("0")
+
+ expect(plugin["counters"]["network"]["interfaces"]["eth0"]["rx"]["bytes"]).to eq("1392844460")
+ expect(plugin["counters"]["network"]["interfaces"]["eth0"]["rx"]["packets"]).to eq("2659966")
+ expect(plugin["counters"]["network"]["interfaces"]["eth0"]["rx"]["errors"]).to eq("0")
+ expect(plugin["counters"]["network"]["interfaces"]["eth0"]["rx"]["overrun"]).to eq("0")
+ expect(plugin["counters"]["network"]["interfaces"]["eth0"]["rx"]["drop"]).to eq("0")
end
it "detects the loopback counters" do
- expect(plugin['counters']['network']['interfaces']['lo']['tx']['bytes']).to eq("35224")
- expect(plugin['counters']['network']['interfaces']['lo']['tx']['packets']).to eq("524")
- expect(plugin['counters']['network']['interfaces']['lo']['tx']['collisions']).to eq("0")
- expect(plugin['counters']['network']['interfaces']['lo']['tx']['errors']).to eq("0")
- expect(plugin['counters']['network']['interfaces']['lo']['tx']['carrier']).to eq("0")
- expect(plugin['counters']['network']['interfaces']['lo']['tx']['drop']).to eq("0")
-
- expect(plugin['counters']['network']['interfaces']['lo']['rx']['bytes']).to eq("35224")
- expect(plugin['counters']['network']['interfaces']['lo']['rx']['packets']).to eq("524")
- expect(plugin['counters']['network']['interfaces']['lo']['rx']['errors']).to eq("0")
- expect(plugin['counters']['network']['interfaces']['lo']['rx']['overrun']).to eq("0")
- expect(plugin['counters']['network']['interfaces']['lo']['rx']['drop']).to eq("0")
+ expect(plugin["counters"]["network"]["interfaces"]["lo"]["tx"]["bytes"]).to eq("35224")
+ expect(plugin["counters"]["network"]["interfaces"]["lo"]["tx"]["packets"]).to eq("524")
+ expect(plugin["counters"]["network"]["interfaces"]["lo"]["tx"]["collisions"]).to eq("0")
+ expect(plugin["counters"]["network"]["interfaces"]["lo"]["tx"]["errors"]).to eq("0")
+ expect(plugin["counters"]["network"]["interfaces"]["lo"]["tx"]["carrier"]).to eq("0")
+ expect(plugin["counters"]["network"]["interfaces"]["lo"]["tx"]["drop"]).to eq("0")
+
+ expect(plugin["counters"]["network"]["interfaces"]["lo"]["rx"]["bytes"]).to eq("35224")
+ expect(plugin["counters"]["network"]["interfaces"]["lo"]["rx"]["packets"]).to eq("524")
+ expect(plugin["counters"]["network"]["interfaces"]["lo"]["rx"]["errors"]).to eq("0")
+ expect(plugin["counters"]["network"]["interfaces"]["lo"]["rx"]["overrun"]).to eq("0")
+ expect(plugin["counters"]["network"]["interfaces"]["lo"]["rx"]["drop"]).to eq("0")
end
end
@@ -524,27 +522,27 @@ fe80::21c:eff:fe12:3456 dev eth0.153 lladdr 00:1c:0e:30:28:00 router REACHABLE
describe "without a subinterface" do
it "finds the default interface by asking which iface has the default route" do
- expect(plugin['network']['default_interface']).to eq('eth0')
+ expect(plugin["network"]["default_interface"]).to eq("eth0")
end
it "finds the default gateway by asking which iface has the default route" do
- expect(plugin['network']['default_gateway']).to eq('10.116.201.1')
+ expect(plugin["network"]["default_gateway"]).to eq("10.116.201.1")
end
end
describe "with a link level default route" do
- let(:linux_ip_route) {
-'10.116.201.0/24 dev eth0 proto kernel
+ let(:linux_ip_route) { <<-EOM
+10.116.201.0/24 dev eth0 proto kernel
default dev eth0 scope link
-'
+EOM
}
- let(:linux_route_n) {
-'Kernel IP routing table
+ let(:linux_route_n) { <<-EOM
+Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
10.116.201.0 0.0.0.0 255.255.255.0 U 0 0 0 eth0
0.0.0.0 0.0.0.0 0.0.0.0 U 0 0 0 eth0
-'
+EOM
}
before(:each) do
@@ -552,27 +550,27 @@ Destination Gateway Genmask Flags Metric Ref Use Iface
end
it "finds the default interface by asking which iface has the default route" do
- expect(plugin['network']['default_interface']).to eq('eth0')
+ expect(plugin["network"]["default_interface"]).to eq("eth0")
end
it "finds the default interface by asking which iface has the default route" do
- expect(plugin['network']['default_gateway']).to eq('0.0.0.0')
+ expect(plugin["network"]["default_gateway"]).to eq("0.0.0.0")
end
end
describe "with a subinterface" do
- let(:linux_ip_route) {
-'192.168.0.0/24 dev eth0.11 proto kernel src 192.168.0.2
+ let(:linux_ip_route) { <<-EOM
+192.168.0.0/24 dev eth0.11 proto kernel src 192.168.0.2
default via 192.168.0.15 dev eth0.11
-'
+EOM
}
- let(:linux_route_n) {
-'Kernel IP routing table
+ let(:linux_route_n) { <<-EOM
+Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
192.168.0.0 0.0.0.0 255.255.255.0 U 0 0 0 eth0.11
0.0.0.0 192.168.0.15 0.0.0.0 UG 0 0 0 eth0.11
-'
+EOM
}
before(:each) do
@@ -580,11 +578,11 @@ Destination Gateway Genmask Flags Metric Ref Use Iface
end
it "finds the default interface by asking which iface has the default route" do
- expect(plugin['network']["default_interface"]).to eq('eth0.11')
+ expect(plugin["network"]["default_interface"]).to eq("eth0.11")
end
it "finds the default interface by asking which iface has the default route" do
- expect(plugin['network']["default_gateway"]).to eq('192.168.0.15')
+ expect(plugin["network"]["default_gateway"]).to eq("192.168.0.15")
end
end
end
@@ -600,44 +598,44 @@ Destination Gateway Genmask Flags Metric Ref Use Iface
it "completes the run" do
expect(Ohai::Log).not_to receive(:debug).with(/Plugin linux::network threw exception/)
- expect(plugin['network']).not_to be_nil
+ expect(plugin["network"]).not_to be_nil
end
it "finds the default inet6 interface if there's a inet6 default route" do
- expect(plugin['network']['default_inet6_interface']).to eq('eth0.11')
+ expect(plugin["network"]["default_inet6_interface"]).to eq("eth0.11")
end
it "finds the default inet6 gateway if there's a inet6 default route" do
- expect(plugin['network']['default_inet6_gateway']).to eq('1111:2222:3333:4444::1')
+ expect(plugin["network"]["default_inet6_gateway"]).to eq("1111:2222:3333:4444::1")
end
it "finds inet6 neighbours" do
- expect(plugin['network']['interfaces']['eth0.11']['neighbour_inet6']['1111:2222:3333:4444::1']).to eq('00:1c:0e:12:34:56')
+ expect(plugin["network"]["interfaces"]["eth0.11"]["neighbour_inet6"]["1111:2222:3333:4444::1"]).to eq("00:1c:0e:12:34:56")
end
it "detects the ipv4 addresses of an ethernet interface with a crazy name" do
- expect(plugin['network']['interfaces']['foo:veth0@eth0']['addresses'].keys).to include('192.168.212.2')
- expect(plugin['network']['interfaces']['foo:veth0@eth0']['addresses']['192.168.212.2']['netmask']).to eq('255.255.255.0')
- expect(plugin['network']['interfaces']['foo:veth0@eth0']['addresses']['192.168.212.2']['family']).to eq('inet')
+ expect(plugin["network"]["interfaces"]["foo:veth0@eth0"]["addresses"].keys).to include("192.168.212.2")
+ expect(plugin["network"]["interfaces"]["foo:veth0@eth0"]["addresses"]["192.168.212.2"]["netmask"]).to eq("255.255.255.0")
+ expect(plugin["network"]["interfaces"]["foo:veth0@eth0"]["addresses"]["192.168.212.2"]["family"]).to eq("inet")
end
it "generates a fake interface for ip aliases for backward compatibility" do
- expect(plugin['network']['interfaces']['eth0:5']['addresses'].keys).to include('192.168.5.1')
- expect(plugin['network']['interfaces']['eth0:5']['addresses']['192.168.5.1']['netmask']).to eq('255.255.255.0')
- expect(plugin['network']['interfaces']['eth0:5']['addresses']['192.168.5.1']['family']).to eq('inet')
+ expect(plugin["network"]["interfaces"]["eth0:5"]["addresses"].keys).to include("192.168.5.1")
+ expect(plugin["network"]["interfaces"]["eth0:5"]["addresses"]["192.168.5.1"]["netmask"]).to eq("255.255.255.0")
+ expect(plugin["network"]["interfaces"]["eth0:5"]["addresses"]["192.168.5.1"]["family"]).to eq("inet")
end
it "adds the vlan information of an interface" do
- expect(plugin['network']['interfaces']['eth0.11']['vlan']['id']).to eq('11')
- expect(plugin['network']['interfaces']['eth0.11']['vlan']['flags']).to eq([ 'REORDER_HDR' ])
+ expect(plugin["network"]["interfaces"]["eth0.11"]["vlan"]["id"]).to eq("11")
+ expect(plugin["network"]["interfaces"]["eth0.11"]["vlan"]["flags"]).to eq([ "REORDER_HDR" ])
end
it "adds the state of an interface" do
- expect(plugin['network']['interfaces']['eth0.11']['state']).to eq('up')
+ expect(plugin["network"]["interfaces"]["eth0.11"]["state"]).to eq("up")
end
it "detects interfaces only visible via ip link" do
- expect(plugin['network']['interfaces']['eth3']['state']).to eq('up')
+ expect(plugin["network"]["interfaces"]["eth3"]["state"]).to eq("up")
end
describe "when IPv6 is disabled" do
@@ -647,28 +645,28 @@ Destination Gateway Genmask Flags Metric Ref Use Iface
end
it "doesn't set ip6address" do
- expect(plugin['ip6address']).to be_nil
+ expect(plugin["ip6address"]).to be_nil
end
end
describe "when dealing with routes" do
it "adds routes" do
plugin.run
- expect(plugin['network']['interfaces']['eth0']['routes']).to include Mash.new( :destination => "10.116.201.0/24", :proto => "kernel", :family =>"inet" )
- expect(plugin['network']['interfaces']['eth0']['routes']).to include Mash.new( :destination => "10.5.4.0/24", :family =>"inet", :via => "10.5.4.1")
- expect(plugin['network']['interfaces']['eth0']['routes']).to include Mash.new( :destination => "10.5.4.0/24", :family =>"inet", :via => "10.5.4.2")
- expect(plugin['network']['interfaces']['foo:veth0@eth0']['routes']).to include Mash.new( :destination => "192.168.212.0/24", :proto => "kernel", :src => "192.168.212.2", :family =>"inet" )
- expect(plugin['network']['interfaces']['eth0']['routes']).to include Mash.new( :destination => "fe80::/64", :metric => "256", :proto => "kernel", :family => "inet6" )
- expect(plugin['network']['interfaces']['eth0.11']['routes']).to include Mash.new( :destination => "1111:2222:3333:4444::/64", :metric => "1024", :family => "inet6" )
- expect(plugin['network']['interfaces']['eth0.11']['routes']).to include Mash.new( :destination => "default", :via => "1111:2222:3333:4444::1", :metric => "1024", :family => "inet6")
+ expect(plugin["network"]["interfaces"]["eth0"]["routes"]).to include Mash.new( :destination => "10.116.201.0/24", :proto => "kernel", :family => "inet" )
+ expect(plugin["network"]["interfaces"]["eth0"]["routes"]).to include Mash.new( :destination => "10.5.4.0/24", :family => "inet", :via => "10.5.4.1")
+ expect(plugin["network"]["interfaces"]["eth0"]["routes"]).to include Mash.new( :destination => "10.5.4.0/24", :family => "inet", :via => "10.5.4.2")
+ expect(plugin["network"]["interfaces"]["foo:veth0@eth0"]["routes"]).to include Mash.new( :destination => "192.168.212.0/24", :proto => "kernel", :src => "192.168.212.2", :family => "inet" )
+ expect(plugin["network"]["interfaces"]["eth0"]["routes"]).to include Mash.new( :destination => "fe80::/64", :metric => "256", :proto => "kernel", :family => "inet6" )
+ expect(plugin["network"]["interfaces"]["eth0.11"]["routes"]).to include Mash.new( :destination => "1111:2222:3333:4444::/64", :metric => "1024", :family => "inet6" )
+ expect(plugin["network"]["interfaces"]["eth0.11"]["routes"]).to include Mash.new( :destination => "default", :via => "1111:2222:3333:4444::1", :metric => "1024", :family => "inet6")
end
describe "when there isn't a source field in route entries and no ipv6 default routes" do
- let(:linux_ip_route_inet6) {
-'fe80::/64 dev eth0 proto kernel metric 256
+ let(:linux_ip_route_inet6) { <<-EOM
+fe80::/64 dev eth0 proto kernel metric 256
fe80::/64 dev eth0.11 proto kernel metric 256
1111:2222:3333:4444::/64 dev eth0.11 metric 1024 expires 86023sec
-'
+EOM
}
before(:each) do
@@ -676,35 +674,35 @@ fe80::/64 dev eth0.11 proto kernel metric 256
end
it "doesn't set ipaddress" do
- expect(plugin['ipaddress']).to be nil
+ expect(plugin["ipaddress"]).to be nil
end
it "doesn't set macaddress" do
- expect(plugin['macaddress']).to be nil
+ expect(plugin["macaddress"]).to be nil
end
it "doesn't set ip6address" do
- expect(plugin['ip6address']).to be nil
+ expect(plugin["ip6address"]).to be nil
end
end
describe "when there's a source field in the default route entry" do
- let(:linux_ip_route) {
-'10.116.201.0/24 dev eth0 proto kernel
+ let(:linux_ip_route) { <<-EOM
+10.116.201.0/24 dev eth0 proto kernel
192.168.5.0/24 dev eth0 proto kernel src 192.168.5.1
192.168.212.0/24 dev foo:veth0@eth0 proto kernel src 192.168.212.2
172.16.151.0/24 dev eth0 proto kernel src 172.16.151.100
192.168.0.0/24 dev eth0 proto kernel src 192.168.0.2
default via 10.116.201.1 dev eth0 src 10.116.201.76
-'
+EOM
}
- let(:linux_ip_route_inet6) {
-'fe80::/64 dev eth0 proto kernel metric 256
+ let(:linux_ip_route_inet6) { <<-EOM
+fe80::/64 dev eth0 proto kernel metric 256
fe80::/64 dev eth0.11 proto kernel metric 256
1111:2222:3333:4444::/64 dev eth0.11 metric 1024
default via 1111:2222:3333:4444::1 dev eth0.11 metric 1024 src 1111:2222:3333:4444::3
-'
+EOM
}
before(:each) do
@@ -713,37 +711,37 @@ default via 1111:2222:3333:4444::1 dev eth0.11 metric 1024 src 1111:2222:3333:
it "completes the run" do
expect(Ohai::Log).not_to receive(:debug).with(/Plugin linux::network threw exception/)
- expect(plugin['network']).not_to be_nil
+ expect(plugin["network"]).not_to be_nil
end
it "sets ipaddress" do
- expect(plugin['ipaddress']).to eq("10.116.201.76")
+ expect(plugin["ipaddress"]).to eq("10.116.201.76")
end
it "sets ip6address" do
- expect(plugin['ip6address']).to eq("1111:2222:3333:4444::3")
+ expect(plugin["ip6address"]).to eq("1111:2222:3333:4444::3")
end
end
describe "when there're several default routes" do
- let(:linux_ip_route) {
-'10.116.201.0/24 dev eth0 proto kernel src 10.116.201.76
+ let(:linux_ip_route) { <<-EOM
+10.116.201.0/24 dev eth0 proto kernel src 10.116.201.76
192.168.5.0/24 dev eth0 proto kernel src 192.168.5.1
192.168.212.0/24 dev foo:veth0@eth0 proto kernel src 192.168.212.2
172.16.151.0/24 dev eth0 proto kernel src 172.16.151.100
192.168.0.0/24 dev eth0 proto kernel src 192.168.0.2
default via 10.116.201.1 dev eth0 metric 10
default via 10.116.201.254 dev eth0 metric 9
-'
+EOM
}
- let(:linux_ip_route_inet6) {
-'fe80::/64 dev eth0 proto kernel metric 256
+ let(:linux_ip_route_inet6) { <<-EOM
+fe80::/64 dev eth0 proto kernel metric 256
fe80::/64 dev eth0.11 proto kernel metric 256
1111:2222:3333:4444::/64 dev eth0.11 metric 1024 src 1111:2222:3333:4444::3
default via 1111:2222:3333:4444::1 dev eth0.11 metric 1024
default via 1111:2222:3333:4444::ffff dev eth0.11 metric 1023
-'
+EOM
}
before(:each) do
@@ -752,39 +750,39 @@ default via 1111:2222:3333:4444::ffff dev eth0.11 metric 1023
it "completes the run" do
expect(Ohai::Log).not_to receive(:debug).with(/Plugin linux::network threw exception/)
- expect(plugin['network']).not_to be_nil
+ expect(plugin["network"]).not_to be_nil
end
it "sets default ipv4 interface and gateway" do
- expect(plugin['network']['default_interface']).to eq('eth0')
- expect(plugin['network']['default_gateway']).to eq('10.116.201.254')
+ expect(plugin["network"]["default_interface"]).to eq("eth0")
+ expect(plugin["network"]["default_gateway"]).to eq("10.116.201.254")
end
it "sets default ipv6 interface and gateway" do
- expect(plugin['network']['default_inet6_interface']).to eq('eth0.11')
- expect(plugin['network']['default_inet6_gateway']).to eq('1111:2222:3333:4444::ffff')
+ expect(plugin["network"]["default_inet6_interface"]).to eq("eth0.11")
+ expect(plugin["network"]["default_inet6_gateway"]).to eq("1111:2222:3333:4444::ffff")
end
end
describe "when there're a mixed setup of routes that could be used to set ipaddress" do
- let(:linux_ip_route) {
-'10.116.201.0/24 dev eth0 proto kernel src 10.116.201.76
+ let(:linux_ip_route) { <<-EOM
+10.116.201.0/24 dev eth0 proto kernel src 10.116.201.76
192.168.5.0/24 dev eth0 proto kernel src 192.168.5.1
192.168.212.0/24 dev foo:veth0@eth0 proto kernel src 192.168.212.2
172.16.151.0/24 dev eth0 proto kernel src 172.16.151.100
192.168.0.0/24 dev eth0 proto kernel src 192.168.0.2
default via 10.116.201.1 dev eth0 metric 10
default via 10.116.201.254 dev eth0 metric 9 src 10.116.201.74
-'
+EOM
}
- let(:linux_ip_route_inet6) {
-'fe80::/64 dev eth0 proto kernel metric 256
+ let(:linux_ip_route_inet6) { <<-EOM
+fe80::/64 dev eth0 proto kernel metric 256
fe80::/64 dev eth0.11 proto kernel metric 256
1111:2222:3333:4444::/64 dev eth0.11 metric 1024 src 1111:2222:3333:4444::3
default via 1111:2222:3333:4444::1 dev eth0.11 metric 1024
default via 1111:2222:3333:4444::ffff dev eth0.11 metric 1023 src 1111:2222:3333:4444::2
-'
+EOM
}
before(:each) do
@@ -793,7 +791,7 @@ default via 1111:2222:3333:4444::ffff dev eth0.11 metric 1023 src 1111:2222:333
it "completes the run" do
expect(Ohai::Log).not_to receive(:debug).with(/Plugin linux::network threw exception/)
- expect(plugin['network']).not_to be_nil
+ expect(plugin["network"]).not_to be_nil
end
it "sets ipaddress" do
@@ -806,82 +804,82 @@ default via 1111:2222:3333:4444::ffff dev eth0.11 metric 1023 src 1111:2222:333
end
describe "when there's a source field in a local route entry but it isnt in the default route" do
- let(:linux_ip_route) {
-'10.116.201.0/24 dev eth0 proto kernel src 10.116.201.76
+ let(:linux_ip_route) { <<-EOM
+10.116.201.0/24 dev eth0 proto kernel src 10.116.201.76
192.168.5.0/24 dev eth0 proto kernel src 192.168.5.1
192.168.212.0/24 dev foo:veth0@eth0 proto kernel src 192.168.212.2
172.16.151.0/24 dev eth0 proto kernel src 172.16.151.100
192.168.0.0/24 dev eth0 proto kernel src 192.168.0.2
default via 10.116.201.1 dev eth0
-'
+EOM
}
- let(:linux_ip_route_inet6) {
-'fe80::/64 dev eth0 proto kernel metric 256
+ let(:linux_ip_route_inet6) { <<-EOM
+fe80::/64 dev eth0 proto kernel metric 256
fe80::/64 dev eth0.11 proto kernel metric 256
1111:2222:3333:4444::/64 dev eth0.11 metric 1024 src 1111:2222:3333:4444::3
default via 1111:2222:3333:4444::1 dev eth0.11 metric 1024
-'
+EOM
}
it "completes the run" do
expect(Ohai::Log).not_to receive(:debug).with(/Plugin linux::network threw exception/)
plugin.run
- expect(plugin['network']).not_to be_nil
+ expect(plugin["network"]).not_to be_nil
end
it "sets ipaddress" do
plugin.run
- expect(plugin['ipaddress']).to eq("10.116.201.76")
+ expect(plugin["ipaddress"]).to eq("10.116.201.76")
end
# without a source address on the default route we cannot pick the an ipv6 address from the interface
# In the future an RFC6724 compliant process should choose ip6address in the network plugin
it "does not set ip6address" do
plugin.run
- expect(plugin['ip6address']).to eq(nil)
+ expect(plugin["ip6address"]).to eq(nil)
end
context "with only ipv6 routes" do
- let(:linux_ip_route) { '' }
+ let(:linux_ip_route) { "" }
it "sets macaddress to the mac address of the ip6 default interface" do
- expect(plugin['macaddress']).to eq("00:AA:BB:CC:DD:EE")
+ expect(plugin["macaddress"]).to eq("00:AA:BB:CC:DD:EE")
end
end
describe "when about to set macaddress" do
it "sets macaddress" do
plugin.run
- expect(plugin['macaddress']).to eq("12:31:3D:02:BE:A2")
+ expect(plugin["macaddress"]).to eq("12:31:3D:02:BE:A2")
end
context "when then ipv4 interface has the NOARP flag and no ipv6 routes exist" do
- let(:linux_ip_route) {
-'10.118.19.1 dev tun0 proto kernel src 10.118.19.39
+ let(:linux_ip_route) { <<-EOM
+10.118.19.1 dev tun0 proto kernel src 10.118.19.39
default via 172.16.19.1 dev tun0
-'
+EOM
}
- let(:linux_ip_route_inet6) { '' }
+ let(:linux_ip_route_inet6) { "" }
it "completes the run" do
expect(Ohai::Log).not_to receive(:debug).with(/Plugin linux::network threw exception/)
plugin.run
- expect(plugin['network']).not_to be_nil
+ expect(plugin["network"]).not_to be_nil
end
it "doesn't set macaddress" do
plugin.run
- expect(plugin['macaddress']).to be_nil
+ expect(plugin["macaddress"]).to be_nil
end
end
end
end
describe "with a link level default route" do
- let(:linux_ip_route) {
-'default dev venet0 scope link
-'
+ let(:linux_ip_route) { <<-EOM
+default dev venet0 scope link
+EOM
}
before(:each) do
@@ -890,19 +888,19 @@ default via 172.16.19.1 dev tun0
it "completes the run" do
expect(Ohai::Log).not_to receive(:debug).with(/Plugin linux::network threw exception/)
- expect(plugin['network']).not_to be_nil
+ expect(plugin["network"]).not_to be_nil
end
it "doesn't set ipaddress" do
- expect(plugin['ipaddress']).to be_nil
+ expect(plugin["ipaddress"]).to be_nil
end
end
describe "when not having a global scope ipv6 address" do
- let(:linux_ip_route_inet6) {
-'fe80::/64 dev eth0 proto kernel metric 256
+ let(:linux_ip_route_inet6) { <<-EOM
+fe80::/64 dev eth0 proto kernel metric 256
default via fe80::21c:eff:fe12:3456 dev eth0.153 src fe80::2e0:81ff:fe2b:48e7 metric 1024
-'
+EOM
}
before(:each) do
plugin.run
@@ -910,30 +908,30 @@ default via fe80::21c:eff:fe12:3456 dev eth0.153 src fe80::2e0:81ff:fe2b:48e7
it "completes the run" do
expect(Ohai::Log).not_to receive(:debug).with(/Plugin linux::network threw exception/)
- expect(plugin['network']).not_to be_nil
+ expect(plugin["network"]).not_to be_nil
end
it "doesn't set ip6address" do
- expect(plugin['ip6address']).to be_nil
+ expect(plugin["ip6address"]).to be_nil
end
end
describe "with no default route" do
- let(:linux_ip_route) {
-'10.116.201.0/24 dev eth0 proto kernel src 10.116.201.76
+ let(:linux_ip_route) { <<-EOM
+10.116.201.0/24 dev eth0 proto kernel src 10.116.201.76
192.168.5.0/24 dev eth0 proto kernel src 192.168.5.1
192.168.212.0/24 dev foo:veth0@eth0 proto kernel src 192.168.212.2
172.16.151.0/24 dev eth0 proto kernel src 172.16.151.100
192.168.0.0/24 dev eth0 proto kernel src 192.168.0.2
-'
+EOM
}
- let(:linux_ip_route_inet6) {
-'fe80::/64 dev eth0 proto kernel metric 256
+ let(:linux_ip_route_inet6) { <<-EOM
+fe80::/64 dev eth0 proto kernel metric 256
fe80::/64 dev eth0.11 proto kernel metric 256
1111:2222:3333:4444::/64 dev eth0.11 metric 1024 src 1111:2222:3333:4444::3
-'
+EOM
}
before(:each) do
@@ -942,21 +940,22 @@ fe80::/64 dev eth0.11 proto kernel metric 256
it "completes the run" do
expect(Ohai::Log).not_to receive(:debug).with(/Plugin linux::network threw exception/)
- expect(plugin['network']).not_to be_nil
+ expect(plugin["network"]).not_to be_nil
end
it "doesn't set ipaddress" do
- expect(plugin['ipaddress']).to be_nil
+ expect(plugin["ipaddress"]).to be_nil
end
it "doesn't set ip6address" do
- expect(plugin['ip6address']).to be_nil
+ expect(plugin["ip6address"]).to be_nil
end
end
describe "with openvz setup" do
- let(:linux_ip_route) {'default dev venet0 scope link' }
- let(:linux_ip_addr) {'1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN
+ let(:linux_ip_route) { "default dev venet0 scope link" }
+ let(:linux_ip_addr) { <<-EOM
+1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
inet 127.0.0.1/8 scope host lo
inet6 ::1/128 scope host
@@ -967,10 +966,11 @@ fe80::/64 dev eth0.11 proto kernel metric 256
inet 10.116.201.76/24 brd 10.116.201.255 scope global venet0:0
inet6 2001:44b8:4160:8f00:a00:27ff:fe13:eacd/64 scope global dynamic
valid_lft 6128sec preferred_lft 2526sec
-'}
+EOM
+ }
# We don't have the corresponding ipv6 data for these tests
- let(:linux_ip_route_inet6) { '' }
- let(:linux_ip_inet6_neighbor_show) { '' }
+ let(:linux_ip_route_inet6) { "" }
+ let(:linux_ip_inet6_neighbor_show) { "" }
before(:each) do
allow(plugin).to receive(:is_openvz?).and_return true
@@ -980,39 +980,39 @@ fe80::/64 dev eth0.11 proto kernel metric 256
it "completes the run" do
expect(Ohai::Log).not_to receive(:debug).with(/Plugin linux::network threw exception/)
- expect(plugin['network']).not_to be_nil
+ expect(plugin["network"]).not_to be_nil
end
it "sets default ipv4 interface and gateway" do
- expect(plugin['network']['default_interface']).to eq('venet0:0')
- expect(plugin['network']['default_gateway']).to eq('0.0.0.0')
+ expect(plugin["network"]["default_interface"]).to eq("venet0:0")
+ expect(plugin["network"]["default_gateway"]).to eq("0.0.0.0")
end
it "sets correct routing information" do
- expect(plugin['network']['interfaces']['venet0:0']['routes']).to eq([Mash.new( :destination => "default", :family => "inet", :scope => "link" )])
+ expect(plugin["network"]["interfaces"]["venet0:0"]["routes"]).to eq([Mash.new( :destination => "default", :family => "inet", :scope => "link" )])
end
it "sets correct address information" do
- expect(plugin['network']['interfaces']['venet0:0']['addresses']).to eq("10.116.201.76" => Mash.new(:family => 'inet', :prefixlen => '24', :netmask =>'255.255.255.0', :broadcast => '10.116.201.255', :scope => "Global"))
+ expect(plugin["network"]["interfaces"]["venet0:0"]["addresses"]).to eq("10.116.201.76" => Mash.new(:family => "inet", :prefixlen => "24", :netmask => "255.255.255.0", :broadcast => "10.116.201.255", :scope => "Global"))
end
end
describe "with irrelevant routes (container setups)" do
- let(:linux_ip_route) {
-'10.116.201.0/26 dev eth0 proto kernel src 10.116.201.39
+ let(:linux_ip_route) { <<-EOM
+10.116.201.0/26 dev eth0 proto kernel src 10.116.201.39
10.116.201.0/26 dev if4 proto kernel src 10.116.201.45
10.118.19.0/26 dev eth0 proto kernel src 10.118.19.39
10.118.19.0/26 dev if5 proto kernel src 10.118.19.45
default via 10.116.201.1 dev eth0 src 10.116.201.99
-'
+EOM
}
- let(:linux_ip_route_inet6) {
-'fe80::/64 dev eth0 proto kernel metric 256
+ let(:linux_ip_route_inet6) { <<-EOM
+fe80::/64 dev eth0 proto kernel metric 256
fe80::/64 dev eth0.11 proto kernel metric 256
1111:2222:3333:4444::/64 dev eth0.11 metric 1024 src 1111:2222:3333:4444::FFFF:2
default via 1111:2222:3333:4444::1 dev eth0.11 metric 1024
-'
+EOM
}
before(:each) do
@@ -1021,29 +1021,29 @@ default via 1111:2222:3333:4444::1 dev eth0.11 metric 1024
it "completes the run" do
expect(Ohai::Log).not_to receive(:debug).with(/Plugin linux::network threw exception/)
- expect(plugin['network']).not_to be_nil
+ expect(plugin["network"]).not_to be_nil
end
it "doesn't add bogus routes" do
- expect(plugin['network']['interfaces']['eth0']['routes']).not_to include Mash.new( :destination => "10.116.201.0/26", :proto => "kernel", :family => "inet", :via => "10.116.201.39" )
- expect(plugin['network']['interfaces']['eth0']['routes']).not_to include Mash.new( :destination => "10.118.19.0/26", :proto => "kernel", :family => "inet", :via => "10.118.19.39" )
- expect(plugin['network']['interfaces']['eth0']['routes']).not_to include Mash.new( :destination => "1111:2222:3333:4444::/64", :family => "inet6", :metric => "1024" )
+ expect(plugin["network"]["interfaces"]["eth0"]["routes"]).not_to include Mash.new( :destination => "10.116.201.0/26", :proto => "kernel", :family => "inet", :via => "10.116.201.39" )
+ expect(plugin["network"]["interfaces"]["eth0"]["routes"]).not_to include Mash.new( :destination => "10.118.19.0/26", :proto => "kernel", :family => "inet", :via => "10.118.19.39" )
+ expect(plugin["network"]["interfaces"]["eth0"]["routes"]).not_to include Mash.new( :destination => "1111:2222:3333:4444::/64", :family => "inet6", :metric => "1024" )
end
it "doesn't set ipaddress" do
- expect(plugin['ipaddress']).to be_nil
+ expect(plugin["ipaddress"]).to be_nil
end
it "doesn't set ip6address" do
- expect(plugin['ip6address']).to be_nil
+ expect(plugin["ip6address"]).to be_nil
end
end
# This should never happen in the real world.
describe "when encountering a surprise interface" do
- let(:linux_ip_route) {
-'192.168.122.0/24 dev virbr0 proto kernel src 192.168.122.1
-'
+ let(:linux_ip_route) { <<-EOM
+192.168.122.0/24 dev virbr0 proto kernel src 192.168.122.1
+EOM
}
it "logs a message and skips previously unseen interfaces in 'ip route show'" do
@@ -1054,8 +1054,8 @@ default via 1111:2222:3333:4444::1 dev eth0.11 metric 1024
end
describe "when running with ip version ss131122" do
- let(:linux_ip_link_s_d) {
-'1: lo: <LOOPBACK,UP,LOWER_UP> mtu 16436 qdisc noqueue state UNKNOWN mode DEFAULT group default
+ let(:linux_ip_link_s_d) { <<-EOM
+1: lo: <LOOPBACK,UP,LOWER_UP> mtu 16436 qdisc noqueue state UNKNOWN mode DEFAULT group default
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00 promiscuity 0
RX: bytes packets errors dropped overrun mcast
35224 524 0 0 0 0
@@ -1086,14 +1086,14 @@ default via 1111:2222:3333:4444::1 dev eth0.11 metric 1024
1392844460 2659966 0 0 0 0
TX: bytes packets errors dropped carrier collsns
691785313 1919690 0 0 0 0
-'
+EOM
}
it "adds the vlan information of an interface" do
plugin.run
- expect(plugin['network']['interfaces']['eth0.11']['vlan']['id']).to eq('11')
- expect(plugin['network']['interfaces']['eth0.11']['vlan']['protocol']).to eq('802.1Q')
- expect(plugin['network']['interfaces']['eth0.11']['vlan']['flags']).to eq([ 'REORDER_HDR' ])
+ expect(plugin["network"]["interfaces"]["eth0.11"]["vlan"]["id"]).to eq("11")
+ expect(plugin["network"]["interfaces"]["eth0.11"]["vlan"]["protocol"]).to eq("802.1Q")
+ expect(plugin["network"]["interfaces"]["eth0.11"]["vlan"]["flags"]).to eq([ "REORDER_HDR" ])
end
end
end
diff --git a/spec/unit/plugins/solaris2/kernel_spec.rb b/spec/unit/plugins/solaris2/kernel_spec.rb
index ad6f9768..4cf82477 100644
--- a/spec/unit/plugins/solaris2/kernel_spec.rb
+++ b/spec/unit/plugins/solaris2/kernel_spec.rb
@@ -151,7 +151,7 @@ describe Ohai::System, "Solaris2.X kernel plugin" do
# Teh daterz
# Id Loadaddr Size Info Rev Module Name
# 6 1180000 4623 1 1 specfs (filesystem for specfs)
- teh_daterz = { "id" => 6, "loadaddr" => "1180000", "size" => 17955, "description" => "filesystem for specfs" }
+ teh_daterz = { "id" => 6, "loadaddr" => "1180000", "size" => 17955, "description" => "filesystem for specfs" }
expect(@plugin[:kernel][:modules].keys).to include("specfs")
expect(@plugin[:kernel][:modules].keys).not_to include("Module")
expect(@plugin[:kernel][:modules]["specfs"]).to eq(teh_daterz)
diff --git a/spec/unit/plugins/windows/cpu_spec.rb b/spec/unit/plugins/windows/cpu_spec.rb
index e2c6a07e..313104bf 100644
--- a/spec/unit/plugins/windows/cpu_spec.rb
+++ b/spec/unit/plugins/windows/cpu_spec.rb
@@ -66,7 +66,6 @@ describe Ohai::System, "Windows cpu plugin" do
@processors = [{ "description" => "Intel64 Family 6 Model 70 Stepping 1",
"deviceid" => "CPU0",
"family" => 2,
- "l2cachesize" => 0,
"manufacturer" => "GenuineIntel",
"maxclockspeed" => 2793,
"numberofcores" => 1,
@@ -78,7 +77,6 @@ describe Ohai::System, "Windows cpu plugin" do
{ "description" => "Intel64 Family 6 Model 70 Stepping 1",
"deviceid" => "CPU1",
"family" => 2,
- "l2cachesize" => 0,
"manufacturer" => "GenuineIntel",
"maxclockspeed" => 2793,
"numberofcores" => 1,