ohai 8.8.1 → 8.9.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile +1 -0
- data/README.md +1 -1
- data/Rakefile +6 -0
- data/bin/ohai +2 -2
- data/lib/ohai.rb +4 -4
- data/lib/ohai/config.rb +2 -2
- data/lib/ohai/dsl.rb +2 -2
- data/lib/ohai/dsl/plugin.rb +3 -3
- data/lib/ohai/dsl/plugin/versionvi.rb +3 -3
- data/lib/ohai/dsl/plugin/versionvii.rb +2 -2
- data/lib/ohai/exception.rb +2 -2
- data/lib/ohai/hints.rb +2 -2
- data/lib/ohai/loader.rb +1 -1
- data/lib/ohai/log.rb +2 -2
- data/lib/ohai/mixin/command.rb +2 -2
- data/lib/ohai/mixin/constant_helper.rb +2 -2
- data/lib/ohai/mixin/dmi_decode.rb +1 -1
- data/lib/ohai/mixin/ec2_metadata.rb +3 -3
- data/lib/ohai/mixin/network_constants.rb +4 -4
- data/lib/ohai/mixin/os.rb +2 -2
- data/lib/ohai/mixin/seconds_to_human.rb +4 -4
- data/lib/ohai/mixin/string.rb +4 -4
- data/lib/ohai/plugin_config.rb +1 -1
- data/lib/ohai/plugins/aix/cpu.rb +35 -29
- data/lib/ohai/plugins/aix/filesystem.rb +58 -40
- data/lib/ohai/plugins/aix/kernel.rb +3 -2
- data/lib/ohai/plugins/aix/memory.rb +4 -3
- data/lib/ohai/plugins/aix/network.rb +6 -4
- data/lib/ohai/plugins/aix/os.rb +30 -0
- data/lib/ohai/plugins/aix/platform.rb +3 -2
- data/lib/ohai/plugins/aix/uptime.rb +3 -2
- data/lib/ohai/plugins/aix/virtualization.rb +115 -5
- data/lib/ohai/plugins/azure.rb +1 -1
- data/lib/ohai/plugins/bsd/filesystem.rb +1 -1
- data/lib/ohai/plugins/command.rb +4 -4
- data/lib/ohai/plugins/darwin/cpu.rb +5 -3
- data/lib/ohai/plugins/darwin/filesystem.rb +4 -4
- data/lib/ohai/plugins/darwin/filesystem2.rb +4 -4
- data/lib/ohai/plugins/darwin/memory.rb +6 -5
- data/lib/ohai/plugins/darwin/network.rb +2 -2
- data/lib/ohai/plugins/darwin/platform.rb +2 -2
- data/lib/ohai/plugins/darwin/system_profiler.rb +2 -2
- data/lib/ohai/plugins/dragonflybsd/os.rb +2 -2
- data/lib/ohai/plugins/ec2.rb +3 -3
- data/lib/ohai/plugins/erlang.rb +3 -3
- data/lib/ohai/plugins/eucalyptus.rb +3 -3
- data/lib/ohai/plugins/freebsd/cpu.rb +8 -4
- data/lib/ohai/plugins/freebsd/os.rb +2 -2
- data/lib/ohai/plugins/hostname.rb +12 -4
- data/lib/ohai/plugins/init_package.rb +2 -8
- data/lib/ohai/plugins/java.rb +2 -2
- data/lib/ohai/plugins/kernel.rb +5 -4
- data/lib/ohai/plugins/keys.rb +3 -3
- data/lib/ohai/plugins/languages.rb +4 -4
- data/lib/ohai/plugins/linux/block_device.rb +3 -3
- data/lib/ohai/plugins/linux/cpu.rb +2 -2
- data/lib/ohai/plugins/linux/filesystem.rb +2 -2
- data/lib/ohai/plugins/linux/filesystem2.rb +3 -3
- data/lib/ohai/plugins/linux/lsb.rb +2 -2
- data/lib/ohai/plugins/linux/memory.rb +2 -2
- data/lib/ohai/plugins/linux/network.rb +141 -59
- data/lib/ohai/plugins/linux/platform.rb +6 -1
- data/lib/ohai/plugins/linux/virtualization.rb +1 -1
- data/lib/ohai/plugins/network.rb +49 -42
- data/lib/ohai/plugins/ohai_time.rb +4 -4
- data/lib/ohai/plugins/openstack.rb +2 -2
- data/lib/ohai/plugins/os.rb +2 -2
- data/lib/ohai/plugins/packages.rb +122 -0
- data/lib/ohai/plugins/perl.rb +5 -5
- data/lib/ohai/plugins/platform.rb +2 -2
- data/lib/ohai/plugins/powershell.rb +2 -2
- data/lib/ohai/plugins/ps.rb +2 -2
- data/lib/ohai/plugins/python.rb +1 -1
- data/lib/ohai/plugins/rackspace.rb +13 -0
- data/lib/ohai/plugins/ruby.rb +6 -6
- data/lib/ohai/plugins/sigar/network_route.rb +1 -1
- data/lib/ohai/plugins/solaris2/filesystem.rb +1 -1
- data/lib/ohai/plugins/solaris2/network.rb +1 -1
- data/lib/ohai/plugins/solaris2/platform.rb +1 -1
- data/lib/ohai/plugins/solaris2/virtualization.rb +5 -5
- data/lib/ohai/plugins/solaris2/zpools.rb +2 -2
- data/lib/ohai/plugins/ssh_host_key.rb +2 -2
- data/lib/ohai/plugins/uptime.rb +4 -4
- data/lib/ohai/plugins/virtualbox.rb +1 -1
- data/lib/ohai/plugins/virtualization.rb +7 -7
- data/lib/ohai/plugins/vmware.rb +1 -1
- data/lib/ohai/plugins/windows/filesystem.rb +1 -1
- data/lib/ohai/plugins/windows/network.rb +1 -1
- data/lib/ohai/plugins/windows/platform.rb +1 -1
- data/lib/ohai/plugins/windows/virtualization.rb +1 -1
- data/lib/ohai/provides_map.rb +3 -3
- data/lib/ohai/runner.rb +2 -2
- data/lib/ohai/system.rb +2 -2
- data/lib/ohai/util/file_helper.rb +1 -1
- data/lib/ohai/util/win32.rb +1 -1
- data/lib/ohai/util/win32/group_helper.rb +1 -1
- data/lib/ohai/version.rb +3 -3
- data/spec/data/plugins/dpkg-query.output +1087 -0
- data/spec/data/plugins/lslpp.output +49 -0
- data/spec/data/plugins/pkginfo.output +50 -0
- data/spec/data/plugins/pkglist.output +24 -0
- data/spec/data/plugins/rpmquery.output +388 -0
- data/spec/functional/application_spec.rb +1 -1
- data/spec/functional/loader_spec.rb +1 -1
- data/spec/functional/plugins/powershell_spec.rb +1 -1
- data/spec/functional/plugins/root_group_spec.rb +2 -2
- data/spec/ohai_spec.rb +6 -6
- data/spec/unit/application_spec.rb +1 -1
- data/spec/unit/config_spec.rb +1 -1
- data/spec/unit/dsl/plugin_spec.rb +2 -2
- data/spec/unit/hints_spec.rb +2 -2
- data/spec/unit/loader_spec.rb +2 -2
- data/spec/unit/mixin/ec2_metadata_spec.rb +1 -1
- data/spec/unit/plugin_config_spec.rb +1 -1
- data/spec/unit/plugins/aix/cpu_spec.rb +68 -40
- data/spec/unit/plugins/aix/filesystem_spec.rb +152 -50
- data/spec/unit/plugins/aix/hostname_spec.rb +5 -3
- data/spec/unit/plugins/aix/kernel_spec.rb +2 -1
- data/spec/unit/plugins/aix/memory_spec.rb +7 -5
- data/spec/unit/plugins/aix/network_spec.rb +17 -1
- data/spec/unit/plugins/aix/os_spec.rb +35 -0
- data/spec/unit/plugins/aix/platform_spec.rb +5 -4
- data/spec/unit/plugins/aix/uptime_spec.rb +2 -1
- data/spec/unit/plugins/aix/virtualization_spec.rb +269 -3
- data/spec/unit/plugins/azure_spec.rb +1 -1
- data/spec/unit/plugins/bsd/filesystem_spec.rb +1 -1
- data/spec/unit/plugins/bsd/virtualization_spec.rb +2 -2
- data/spec/unit/plugins/chef_spec.rb +8 -8
- data/spec/unit/plugins/darwin/cpu_spec.rb +8 -3
- data/spec/unit/plugins/darwin/hostname_spec.rb +2 -2
- data/spec/unit/plugins/darwin/kernel_spec.rb +4 -4
- data/spec/unit/plugins/darwin/memory_spec.rb +1 -1
- data/spec/unit/plugins/darwin/network_spec.rb +1 -1
- data/spec/unit/plugins/darwin/platform_spec.rb +6 -6
- data/spec/unit/plugins/darwin/system_profiler_output.rb +0 -1
- data/spec/unit/plugins/darwin/system_profiler_spec.rb +4 -4
- data/spec/unit/plugins/ec2_spec.rb +3 -3
- data/spec/unit/plugins/erlang_spec.rb +3 -3
- data/spec/unit/plugins/eucalyptus_spec.rb +2 -2
- data/spec/unit/plugins/fail_spec.rb +6 -6
- data/spec/unit/plugins/freebsd/cpu_spec.rb +19 -4
- data/spec/unit/plugins/freebsd/hostname_spec.rb +2 -2
- data/spec/unit/plugins/freebsd/kernel_spec.rb +4 -4
- data/spec/unit/plugins/freebsd/platform_spec.rb +7 -7
- data/spec/unit/plugins/hostname_spec.rb +2 -2
- data/spec/unit/plugins/init_package_spec.rb +12 -2
- data/spec/unit/plugins/java_spec.rb +5 -5
- data/spec/unit/plugins/kernel_spec.rb +4 -2
- data/spec/unit/plugins/linux/block_device_spec.rb +75 -0
- data/spec/unit/plugins/linux/cpu_spec.rb +2 -2
- data/spec/unit/plugins/linux/filesystem2_spec.rb +14 -14
- data/spec/unit/plugins/linux/filesystem_spec.rb +1 -1
- data/spec/unit/plugins/linux/hostname_spec.rb +2 -2
- data/spec/unit/plugins/linux/kernel_spec.rb +5 -5
- data/spec/unit/plugins/linux/lsb_spec.rb +17 -17
- data/spec/unit/plugins/linux/network_spec.rb +80 -11
- data/spec/unit/plugins/linux/platform_spec.rb +20 -1
- data/spec/unit/plugins/linux/uptime_spec.rb +8 -8
- data/spec/unit/plugins/linux/virtualization_spec.rb +1 -1
- data/spec/unit/plugins/lua_spec.rb +2 -2
- data/spec/unit/plugins/netbsd/hostname_spec.rb +2 -2
- data/spec/unit/plugins/netbsd/kernel_spec.rb +2 -2
- data/spec/unit/plugins/netbsd/platform_spec.rb +2 -2
- data/spec/unit/plugins/network_spec.rb +110 -37
- data/spec/unit/plugins/nodejs_spec.rb +2 -2
- data/spec/unit/plugins/ohai_spec.rb +5 -5
- data/spec/unit/plugins/ohai_time_spec.rb +8 -8
- data/spec/unit/plugins/openbsd/hostname_spec.rb +2 -2
- data/spec/unit/plugins/openbsd/kernel_spec.rb +4 -4
- data/spec/unit/plugins/openbsd/platform_spec.rb +6 -6
- data/spec/unit/plugins/openstack_spec.rb +2 -2
- data/spec/unit/plugins/os_spec.rb +11 -11
- data/spec/unit/plugins/packages_spec.rb +241 -0
- data/spec/unit/plugins/perl_spec.rb +3 -3
- data/spec/unit/plugins/php_spec.rb +2 -2
- data/spec/unit/plugins/platform_spec.rb +2 -2
- data/spec/unit/plugins/python_spec.rb +3 -3
- data/spec/unit/plugins/rackspace_spec.rb +7 -0
- data/spec/unit/plugins/ruby_spec.rb +3 -3
- data/spec/unit/plugins/sigar/network_route_spec.rb +1 -1
- data/spec/unit/plugins/solaris2/cpu_spec.rb +1 -1
- data/spec/unit/plugins/solaris2/filesystem.rb +1 -1
- data/spec/unit/plugins/solaris2/network_spec.rb +3 -3
- data/spec/unit/plugins/solaris2/platform_spec.rb +5 -5
- data/spec/unit/plugins/solaris2/virtualization_spec.rb +1 -1
- data/spec/unit/plugins/ssh_host_keys_spec.rb +2 -2
- data/spec/unit/plugins/virtualbox_spec.rb +1 -1
- data/spec/unit/plugins/windows/virtualization_spec.rb +1 -1
- data/spec/unit/provides_map_spec.rb +2 -2
- data/spec/unit/runner_spec.rb +2 -2
- data/spec/unit/system_spec.rb +3 -3
- data/spec/unit/util/file_helper_spec.rb +1 -1
- metadata +13 -3
@@ -1,15 +1,15 @@
|
|
1
1
|
#
|
2
|
-
# Author:: Benjamin Black (<bb@
|
3
|
-
# Author:: Theodore Nordsieck (<theo@
|
4
|
-
# Copyright:: Copyright (c) 2009-
|
2
|
+
# Author:: Benjamin Black (<bb@chef.io>)
|
3
|
+
# Author:: Theodore Nordsieck (<theo@chef.io>)
|
4
|
+
# Copyright:: Copyright (c) 2009-2016 Chef Software, Inc.
|
5
5
|
# License:: Apache License, Version 2.0
|
6
6
|
#
|
7
7
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
8
8
|
# you may not use this file except in compliance with the License.
|
9
9
|
# You may obtain a copy of the License at
|
10
|
-
#
|
10
|
+
#
|
11
11
|
# http://www.apache.org/licenses/LICENSE-2.0
|
12
|
-
#
|
12
|
+
#
|
13
13
|
# Unless required by applicable law or agreed to in writing, software
|
14
14
|
# distributed under the License is distributed on an "AS IS" BASIS,
|
15
15
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
@@ -1,6 +1,6 @@
|
|
1
1
|
#
|
2
|
-
# Author:: Adam Jacob (<adam@
|
3
|
-
# Copyright:: Copyright (c) 2008
|
2
|
+
# Author:: Adam Jacob (<adam@chef.io>)
|
3
|
+
# Copyright:: Copyright (c) 2008-2016 Chef Software, Inc.
|
4
4
|
# License:: Apache License, Version 2.0
|
5
5
|
#
|
6
6
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
@@ -28,12 +28,14 @@ describe Ohai::System, "plugin kernel" do
|
|
28
28
|
allow(@plugin).to receive(:shell_out).with("uname -v").and_return(mock_shell_out(0, "Darwin Kernel Version 9.5.0: Wed Sep 3 11:29:43 PDT 2008; root:xnu-1228.7.58~1\/RELEASE_I386\n", ""))
|
29
29
|
allow(@plugin).to receive(:shell_out).with("uname -m").and_return(mock_shell_out(0, "i386\n", ""))
|
30
30
|
allow(@plugin).to receive(:shell_out).with("uname -o").and_return(mock_shell_out(0, "Linux\n", ""))
|
31
|
+
allow(@plugin).to receive(:shell_out).with("uname -p").and_return(mock_shell_out(0, "i386\n", ""))
|
31
32
|
end
|
32
33
|
|
33
34
|
it_should_check_from_mash("kernel", "name", "uname -s", [0, "Darwin\n", ""])
|
34
35
|
it_should_check_from_mash("kernel", "release", "uname -r", [0, "9.5.0\n", ""])
|
35
36
|
it_should_check_from_mash("kernel", "version", "uname -v", [0, "Darwin Kernel Version 9.5.0: Wed Sep 3 11:29:43 PDT 2008; root:xnu-1228.7.58~1\/RELEASE_I386\n", ""])
|
36
37
|
it_should_check_from_mash("kernel", "machine", "uname -m", [0, "i386\n", ""])
|
38
|
+
it_should_check_from_mash("kernel", "processor", "uname -p", [0, "i386\n", ""])
|
37
39
|
|
38
40
|
describe "when running on windows", :windows_only do
|
39
41
|
before do
|
@@ -0,0 +1,75 @@
|
|
1
|
+
#
|
2
|
+
# Author:: Jennifer Marie Howard-Brown <jm.howardbrown@gmail.com>
|
3
|
+
# License:: Apache License, Version 2.0
|
4
|
+
#
|
5
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
6
|
+
# you may not use this file except in compliance with the License.
|
7
|
+
# You may obtain a copy of the License at
|
8
|
+
#
|
9
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
10
|
+
#
|
11
|
+
# Unless required by applicable law or agreed to in writing, software
|
12
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
13
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
14
|
+
# See the License for the specific language governing permissions and
|
15
|
+
# limitations under the License.
|
16
|
+
#
|
17
|
+
|
18
|
+
require File.expand_path(File.dirname(__FILE__) + '/../../../spec_helper.rb')
|
19
|
+
|
20
|
+
describe Ohai::System, 'Linux Block Device Plugin' do
|
21
|
+
DISKS = {
|
22
|
+
'sda' => {
|
23
|
+
'size' => '7814037168',
|
24
|
+
'removable' => '0',
|
25
|
+
'model' => 'WDC WD4000F9YZ-0',
|
26
|
+
'rev' => '1A01',
|
27
|
+
'state' => 'running',
|
28
|
+
'timeout' => '30',
|
29
|
+
'queue_depth' => '1',
|
30
|
+
'vendor' => 'ATA'
|
31
|
+
},
|
32
|
+
'dm-0' => {
|
33
|
+
'size' => '7806976',
|
34
|
+
'removable' => '0'
|
35
|
+
}
|
36
|
+
}
|
37
|
+
|
38
|
+
def file_double(value)
|
39
|
+
tmp_double = double
|
40
|
+
expect(tmp_double).to receive(:read_nonblock).and_return(value)
|
41
|
+
tmp_double
|
42
|
+
end
|
43
|
+
|
44
|
+
before(:each) do
|
45
|
+
@plugin = get_plugin('linux/block_device')
|
46
|
+
allow(@plugin).to receive(:collect_os).and_return(:linux)
|
47
|
+
|
48
|
+
allow(File).to receive(:exists?).with('/sys/block').and_return(true)
|
49
|
+
allow(Dir).to receive(:[]).with('/sys/block/*') do
|
50
|
+
DISKS.collect { |disk, _files| "/sys/block/#{disk}" }
|
51
|
+
end
|
52
|
+
|
53
|
+
DISKS.each do |disk, checks|
|
54
|
+
checks.each do |check, value|
|
55
|
+
allow(File).to receive(:open).with(Regexp.new("#{disk}.*#{check}")).and_yield(file_double(value))
|
56
|
+
end
|
57
|
+
|
58
|
+
allow(File).to receive(:exists?).with(Regexp.new(disk)) do |arg|
|
59
|
+
filepath = arg.split('/')
|
60
|
+
checks[filepath.last].nil? ? false : true
|
61
|
+
end
|
62
|
+
|
63
|
+
allow(File).to receive(:basename) do |arg|
|
64
|
+
arg.split('/').last
|
65
|
+
end
|
66
|
+
end
|
67
|
+
end
|
68
|
+
|
69
|
+
it 'should collect all relevant data from disks' do
|
70
|
+
@plugin.run
|
71
|
+
DISKS.each do |disk, checks|
|
72
|
+
expect(@plugin[:block_device][disk.to_sym]).to include(checks)
|
73
|
+
end
|
74
|
+
end
|
75
|
+
end
|
@@ -1,6 +1,6 @@
|
|
1
1
|
#
|
2
|
-
# Author:: Adam Jacob (<adam@
|
3
|
-
# Copyright:: Copyright (c) 2008-
|
2
|
+
# Author:: Adam Jacob (<adam@chef.io>)
|
3
|
+
# Copyright:: Copyright (c) 2008-2016 Chef Software, Inc.
|
4
4
|
# License:: Apache License, Version 2.0
|
5
5
|
#
|
6
6
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
@@ -1,14 +1,14 @@
|
|
1
1
|
#
|
2
2
|
# Author:: Matthew Kent (<mkent@magoazul.com>)
|
3
|
-
# Copyright:: Copyright (c) 2011
|
3
|
+
# Copyright:: Copyright (c) 2011-2016 Chef Software, Inc.
|
4
4
|
# License:: Apache License, Version 2.0
|
5
5
|
#
|
6
6
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
7
7
|
# you may not use this file except in compliance with the License.
|
8
8
|
# You may obtain a copy of the License at
|
9
|
-
#
|
9
|
+
#
|
10
10
|
# http://www.apache.org/licenses/LICENSE-2.0
|
11
|
-
#
|
11
|
+
#
|
12
12
|
# Unless required by applicable law or agreed to in writing, software
|
13
13
|
# distributed under the License is distributed on an "AS IS" BASIS,
|
14
14
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
@@ -68,7 +68,7 @@ tmpfs 2030944 2960 2027984 1% /dev/shm
|
|
68
68
|
/dev/md0 960492 36388 875312 4% /boot
|
69
69
|
DF
|
70
70
|
allow(plugin).to receive(:shell_out).with("df -P").and_return(mock_shell_out(0, @stdout, ""))
|
71
|
-
|
71
|
+
|
72
72
|
@inode_stdout = <<-DFi
|
73
73
|
Filesystem Inodes IUsed IFree IUse% Mounted on
|
74
74
|
/dev/xvda1 1310720 107407 1203313 9% /
|
@@ -110,17 +110,17 @@ DFi
|
|
110
110
|
plugin.run
|
111
111
|
expect(plugin[:filesystem2]["by_pair"]["/dev/mapper/sys.vg-special.lv,/special"][:mount]).to eq("/special")
|
112
112
|
end
|
113
|
-
|
113
|
+
|
114
114
|
it "should set total_inodes to value from df -iP" do
|
115
115
|
plugin.run
|
116
116
|
expect(plugin[:filesystem2]["by_pair"]["/dev/mapper/sys.vg-special.lv,/special"][:total_inodes]).to eq("124865")
|
117
117
|
end
|
118
|
-
|
118
|
+
|
119
119
|
it "should set inodes_used to value from df -iP" do
|
120
120
|
plugin.run
|
121
121
|
expect(plugin[:filesystem2]["by_pair"]["/dev/mapper/sys.vg-special.lv,/special"][:inodes_used]).to eq("380")
|
122
122
|
end
|
123
|
-
|
123
|
+
|
124
124
|
it "should set inodes_available to value from df -iP" do
|
125
125
|
plugin.run
|
126
126
|
expect(plugin[:filesystem2]["by_pair"]["/dev/mapper/sys.vg-special.lv,/special"][:inodes_available]).to eq("124485")
|
@@ -188,7 +188,7 @@ tmpfs 2030944 2960 2027984 1% /dev/shm
|
|
188
188
|
/dev/md0 960492 36388 875312 4% /boot
|
189
189
|
DF
|
190
190
|
allow(plugin).to receive(:shell_out).with("df -P").and_return(mock_shell_out(0, @dfstdout, ""))
|
191
|
-
|
191
|
+
|
192
192
|
@inode_stdout = <<-DFi
|
193
193
|
Filesystem Inodes IUsed IFree IUse% Mounted on
|
194
194
|
/dev/xvda1 1310720 107407 1203313 9% /
|
@@ -205,7 +205,7 @@ DFi
|
|
205
205
|
/dev/sda1: LABEL=\"fuego:0\" UUID=\"bd1197e0-6997-1f3a-e27e-7801388308b5\" TYPE=\"linux_raid_member\"
|
206
206
|
/dev/sda2: LABEL=\"fuego:1\" UUID=\"e36d933e-e5b9-cfe5-6845-1f84d0f7fbfa\" TYPE=\"linux_raid_member\"
|
207
207
|
/dev/md0: LABEL=\"/boot\" UUID=\"37b8de8e-0fe3-4b5a-b9b4-dde33e19bb32\" TYPE=\"ext3\"
|
208
|
-
/dev/md1: UUID=\"YsIe0R-fj1y-LXTd-imla-opKo-OuIe-TBoxSK\" TYPE=\"LVM2_member\"
|
208
|
+
/dev/md1: UUID=\"YsIe0R-fj1y-LXTd-imla-opKo-OuIe-TBoxSK\" TYPE=\"LVM2_member\"
|
209
209
|
/dev/mapper/sys.vg-root.lv: LABEL=\"/\" UUID=\"7742d14b-80a3-4e97-9a32-478be9ea9aea\" TYPE=\"ext4\"
|
210
210
|
/dev/mapper/sys.vg-swap.lv: UUID=\"9bc2e515-8ddc-41c3-9f63-4eaebde9ce96\" TYPE=\"swap\"
|
211
211
|
/dev/mapper/sys.vg-tmp.lv: LABEL=\"/tmp\" UUID=\"74cf7eb9-428f-479e-9a4a-9943401e81e5\" TYPE=\"ext4\"
|
@@ -244,7 +244,7 @@ tmpfs 2030944 2960 2027984 1% /dev/shm
|
|
244
244
|
/dev/md0 960492 36388 875312 4% /boot
|
245
245
|
DF
|
246
246
|
allow(plugin).to receive(:shell_out).with("df -P").and_return(mock_shell_out(0, @dfstdout, ""))
|
247
|
-
|
247
|
+
|
248
248
|
@inode_stdout = <<-DFi
|
249
249
|
Filesystem Inodes IUsed IFree IUse% Mounted on
|
250
250
|
/dev/xvda1 1310720 107407 1203313 9% /
|
@@ -330,12 +330,12 @@ MOUNTS
|
|
330
330
|
plugin.run
|
331
331
|
expect(plugin[:filesystem2]["by_pair"]["/dev/mapper/sys.vg-special.lv,/special"][:mount]).to eq("/special")
|
332
332
|
end
|
333
|
-
|
333
|
+
|
334
334
|
it "should set fs_type to value from /proc/mounts" do
|
335
335
|
plugin.run
|
336
336
|
expect(plugin[:filesystem2]["by_pair"]["/dev/mapper/sys.vg-special.lv,/special"][:fs_type]).to eq("xfs")
|
337
337
|
end
|
338
|
-
|
338
|
+
|
339
339
|
it "should set mount_options to an array of values from /proc/mounts" do
|
340
340
|
plugin.run
|
341
341
|
expect(plugin[:filesystem2]["by_pair"]["/dev/mapper/sys.vg-special.lv,/special"][:mount_options]).to eq([ "ro", "noatime", "attr2", "noquota" ])
|
@@ -360,7 +360,7 @@ tmpfs 2030944 2960 2027984 1% /dev/shm
|
|
360
360
|
/dev/mapper/sys.vg-root.lv 4805760 378716 4182924 9% /var/chroot
|
361
361
|
DF
|
362
362
|
allow(plugin).to receive(:shell_out).with("df -P").and_return(mock_shell_out(0, @dfstdout, ""))
|
363
|
-
|
363
|
+
|
364
364
|
@inode_stdout = <<-DFi
|
365
365
|
Filesystem Inodes IUsed IFree IUse% Mounted on
|
366
366
|
/dev/mapper/sys.vg-root.lv 1310720 107407 1203313 9% /
|
@@ -404,7 +404,7 @@ tmpfs 2030944 2960 2027984 1% /dev/shm
|
|
404
404
|
/dev/sdc1 4805760 378716 4182924 9% /mnt
|
405
405
|
DF
|
406
406
|
allow(plugin).to receive(:shell_out).with("df -P").and_return(mock_shell_out(0, @dfstdout, ""))
|
407
|
-
|
407
|
+
|
408
408
|
@inode_stdout = <<-DFi
|
409
409
|
Filesystem Inodes IUsed IFree IUse% Mounted on
|
410
410
|
/dev/mapper/sys.vg-root.lv 1310720 107407 1203313 9% /
|
@@ -1,6 +1,6 @@
|
|
1
1
|
#
|
2
2
|
# Author:: Matthew Kent (<mkent@magoazul.com>)
|
3
|
-
# Copyright:: Copyright (c) 2011
|
3
|
+
# Copyright:: Copyright (c) 2011-2016 Chef Software, Inc.
|
4
4
|
# License:: Apache License, Version 2.0
|
5
5
|
#
|
6
6
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
@@ -1,6 +1,6 @@
|
|
1
1
|
#
|
2
|
-
# Author:: Adam Jacob (<adam@
|
3
|
-
# Copyright:: Copyright (c) 2008
|
2
|
+
# Author:: Adam Jacob (<adam@chef.io>)
|
3
|
+
# Copyright:: Copyright (c) 2008-2016 Chef Software, Inc.
|
4
4
|
# License:: Apache License, Version 2.0
|
5
5
|
#
|
6
6
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
@@ -1,15 +1,15 @@
|
|
1
1
|
#
|
2
|
-
# Author:: Adam Jacob (<adam@
|
3
|
-
# Author:: Theodore Nordsieck (<theo@
|
4
|
-
# Copyright:: Copyright (c) 2008-
|
2
|
+
# Author:: Adam Jacob (<adam@chef.io>)
|
3
|
+
# Author:: Theodore Nordsieck (<theo@chef.io>)
|
4
|
+
# Copyright:: Copyright (c) 2008-2016 Chef Software, Inc.
|
5
5
|
# License:: Apache License, Version 2.0
|
6
6
|
#
|
7
7
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
8
8
|
# you may not use this file except in compliance with the License.
|
9
9
|
# You may obtain a copy of the License at
|
10
|
-
#
|
10
|
+
#
|
11
11
|
# http://www.apache.org/licenses/LICENSE-2.0
|
12
|
-
#
|
12
|
+
#
|
13
13
|
# Unless required by applicable law or agreed to in writing, software
|
14
14
|
# distributed under the License is distributed on an "AS IS" BASIS,
|
15
15
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
@@ -1,14 +1,14 @@
|
|
1
1
|
#
|
2
|
-
# Author:: Adam Jacob (<adam@
|
3
|
-
# Copyright:: Copyright (c) 2008
|
2
|
+
# Author:: Adam Jacob (<adam@chef.io>)
|
3
|
+
# Copyright:: Copyright (c) 2008-2016 Chef Software, Inc.
|
4
4
|
# License:: Apache License, Version 2.0
|
5
5
|
#
|
6
6
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
7
7
|
# you may not use this file except in compliance with the License.
|
8
8
|
# You may obtain a copy of the License at
|
9
|
-
#
|
9
|
+
#
|
10
10
|
# http://www.apache.org/licenses/LICENSE-2.0
|
11
|
-
#
|
11
|
+
#
|
12
12
|
# Unless required by applicable law or agreed to in writing, software
|
13
13
|
# distributed under the License is distributed on an "AS IS" BASIS,
|
14
14
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
@@ -35,7 +35,7 @@ describe Ohai::System, "Linux lsb plugin" do
|
|
35
35
|
and_yield("DISTRIB_RELEASE=8.04").
|
36
36
|
and_yield("DISTRIB_CODENAME=hardy").
|
37
37
|
and_yield('DISTRIB_DESCRIPTION="Ubuntu 8.04"')
|
38
|
-
allow(File).to receive(:open).with("/etc/lsb-release").and_return(@double_file)
|
38
|
+
allow(File).to receive(:open).with("/etc/lsb-release").and_return(@double_file)
|
39
39
|
allow(File).to receive(:exists?).with("/etc/lsb-release").and_return(true)
|
40
40
|
end
|
41
41
|
|
@@ -43,17 +43,17 @@ describe Ohai::System, "Linux lsb plugin" do
|
|
43
43
|
@plugin.run
|
44
44
|
expect(@plugin[:lsb][:id]).to eq("Ubuntu")
|
45
45
|
end
|
46
|
-
|
46
|
+
|
47
47
|
it "should set lsb[:release]" do
|
48
48
|
@plugin.run
|
49
49
|
expect(@plugin[:lsb][:release]).to eq("8.04")
|
50
50
|
end
|
51
|
-
|
51
|
+
|
52
52
|
it "should set lsb[:codename]" do
|
53
53
|
@plugin.run
|
54
54
|
expect(@plugin[:lsb][:codename]).to eq("hardy")
|
55
55
|
end
|
56
|
-
|
56
|
+
|
57
57
|
it "should set lsb[:description]" do
|
58
58
|
@plugin.run
|
59
59
|
expect(@plugin[:lsb][:description]).to eq("Ubuntu 8.04")
|
@@ -64,7 +64,7 @@ describe Ohai::System, "Linux lsb plugin" do
|
|
64
64
|
before(:each) do
|
65
65
|
allow(File).to receive(:exists?).with("/etc/lsb-release").and_return(false)
|
66
66
|
allow(File).to receive(:exists?).with("/usr/bin/lsb_release").and_return(true)
|
67
|
-
|
67
|
+
|
68
68
|
@stdin = double("STDIN", { :close => true })
|
69
69
|
@pid = 10
|
70
70
|
@stderr = double("STDERR")
|
@@ -72,7 +72,7 @@ describe Ohai::System, "Linux lsb plugin" do
|
|
72
72
|
@status = 0
|
73
73
|
|
74
74
|
end
|
75
|
-
|
75
|
+
|
76
76
|
describe "on Centos 5.4 correctly" do
|
77
77
|
before(:each) do
|
78
78
|
@stdout = <<-LSB_RELEASE
|
@@ -89,17 +89,17 @@ LSB_RELEASE
|
|
89
89
|
@plugin.run
|
90
90
|
expect(@plugin[:lsb][:id]).to eq("CentOS")
|
91
91
|
end
|
92
|
-
|
92
|
+
|
93
93
|
it "should set lsb[:release]" do
|
94
94
|
@plugin.run
|
95
95
|
expect(@plugin[:lsb][:release]).to eq("5.4")
|
96
96
|
end
|
97
|
-
|
97
|
+
|
98
98
|
it "should set lsb[:codename]" do
|
99
99
|
@plugin.run
|
100
100
|
expect(@plugin[:lsb][:codename]).to eq("Final")
|
101
101
|
end
|
102
|
-
|
102
|
+
|
103
103
|
it "should set lsb[:description]" do
|
104
104
|
@plugin.run
|
105
105
|
expect(@plugin[:lsb][:description]).to eq("CentOS release 5.4 (Final)")
|
@@ -117,22 +117,22 @@ Codename: Laughlin
|
|
117
117
|
LSB_RELEASE
|
118
118
|
allow(@plugin).to receive(:shell_out).with("lsb_release -a").and_return(mock_shell_out(0, @stdout, ""))
|
119
119
|
end
|
120
|
-
|
120
|
+
|
121
121
|
it "should set lsb[:id]" do
|
122
122
|
@plugin.run
|
123
123
|
expect(@plugin[:lsb][:id]).to eq("Fedora")
|
124
124
|
end
|
125
|
-
|
125
|
+
|
126
126
|
it "should set lsb[:release]" do
|
127
127
|
@plugin.run
|
128
128
|
expect(@plugin[:lsb][:release]).to eq("14")
|
129
129
|
end
|
130
|
-
|
130
|
+
|
131
131
|
it "should set lsb[:codename]" do
|
132
132
|
@plugin.run
|
133
133
|
expect(@plugin[:lsb][:codename]).to eq("Laughlin")
|
134
134
|
end
|
135
|
-
|
135
|
+
|
136
136
|
it "should set lsb[:description]" do
|
137
137
|
@plugin.run
|
138
138
|
expect(@plugin[:lsb][:description]).to eq("Fedora release 14 (Laughlin)")
|
@@ -1,7 +1,7 @@
|
|
1
1
|
#
|
2
2
|
# Author:: Caleb Tennis <caleb.tennis@gmail.com>
|
3
3
|
# Author:: Chris Read <chris.read@gmail.com>
|
4
|
-
# Copyright:: Copyright (c) 2011
|
4
|
+
# Copyright:: Copyright (c) 2011-2016 Chef Software, Inc.
|
5
5
|
# License:: Apache License, Version 2.0
|
6
6
|
#
|
7
7
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
@@ -298,6 +298,31 @@ fe80::21c:eff:fe12:3456 dev eth0.153 lladdr 00:1c:0e:30:28:00 router REACHABLE
|
|
298
298
|
'
|
299
299
|
}
|
300
300
|
|
301
|
+
let(:linux_ethtool) {
|
302
|
+
'Settings for eth0:
|
303
|
+
Supported ports: [ FIBRE ]
|
304
|
+
Supported link modes: 1000baseT/Full
|
305
|
+
10000baseT/Full
|
306
|
+
Supported pause frame use: No
|
307
|
+
Supports auto-negotiation: Yes
|
308
|
+
Advertised link modes: 1000baseT/Full
|
309
|
+
10000baseT/Full
|
310
|
+
Advertised pause frame use: No
|
311
|
+
Advertised auto-negotiation: Yes
|
312
|
+
Speed: 10000Mb/s
|
313
|
+
Duplex: Full
|
314
|
+
Port: FIBRE
|
315
|
+
PHYAD: 0
|
316
|
+
Transceiver: external
|
317
|
+
Auto-negotiation: on
|
318
|
+
Supports Wake-on: d
|
319
|
+
Wake-on: d
|
320
|
+
Current message level: 0x00000007 (7)
|
321
|
+
drv probe link
|
322
|
+
Link detected: yes
|
323
|
+
'
|
324
|
+
}
|
325
|
+
|
301
326
|
before(:each) do
|
302
327
|
allow(plugin).to receive(:collect_os).and_return(:linux)
|
303
328
|
|
@@ -305,12 +330,13 @@ fe80::21c:eff:fe12:3456 dev eth0.153 lladdr 00:1c:0e:30:28:00 router REACHABLE
|
|
305
330
|
allow(plugin).to receive(:shell_out).with("ip -d -s link").and_return(mock_shell_out(0, linux_ip_link_s_d, ""))
|
306
331
|
allow(plugin).to receive(:shell_out).with("ip -f inet neigh show").and_return(mock_shell_out(0, linux_ip_neighbor_show, ""))
|
307
332
|
allow(plugin).to receive(:shell_out).with("ip -f inet6 neigh show").and_return(mock_shell_out(0, linux_ip_inet6_neighbor_show, ""))
|
308
|
-
allow(plugin).to receive(:shell_out).with("ip -o -f inet route show").and_return(mock_shell_out(0, linux_ip_route, ""))
|
309
|
-
allow(plugin).to receive(:shell_out).with("ip -o -f inet6 route show").and_return(mock_shell_out(0, linux_ip_route_inet6, ""))
|
333
|
+
allow(plugin).to receive(:shell_out).with("ip -o -f inet route show table main").and_return(mock_shell_out(0, linux_ip_route, ""))
|
334
|
+
allow(plugin).to receive(:shell_out).with("ip -o -f inet6 route show table main").and_return(mock_shell_out(0, linux_ip_route_inet6, ""))
|
310
335
|
|
311
336
|
allow(plugin).to receive(:shell_out).with("route -n").and_return(mock_shell_out(0, linux_route_n, ""))
|
312
337
|
allow(plugin).to receive(:shell_out).with("ifconfig -a").and_return(mock_shell_out(0, linux_ifconfig, ""))
|
313
338
|
allow(plugin).to receive(:shell_out).with("arp -an").and_return(mock_shell_out(0, linux_arp_an, ""))
|
339
|
+
allow(plugin).to receive(:shell_out).with(/ethtool/).and_return(mock_shell_out(0, linux_ethtool, ""))
|
314
340
|
end
|
315
341
|
|
316
342
|
describe "#iproute2_binary_available?" do
|
@@ -323,11 +349,23 @@ fe80::21c:eff:fe12:3456 dev eth0.153 lladdr 00:1c:0e:30:28:00 router REACHABLE
|
|
323
349
|
end
|
324
350
|
end
|
325
351
|
|
352
|
+
describe "#find_ethtool_binary" do
|
353
|
+
["/sbin/ethtool", "/usr/sbin/ethtool"].each do |path|
|
354
|
+
it "accepts #{path}" do
|
355
|
+
allow(File).to receive(:exist?).and_return(false)
|
356
|
+
allow(File).to receive(:exist?).with(path).and_return(true)
|
357
|
+
expect(plugin.find_ethtool_binary).to end_with("/ethtool")
|
358
|
+
end
|
359
|
+
end
|
360
|
+
end
|
361
|
+
|
362
|
+
|
326
363
|
["ifconfig","iproute2"].each do |network_method|
|
327
364
|
|
328
365
|
describe "gathering IP layer address info via #{network_method}" do
|
329
366
|
before(:each) do
|
330
367
|
allow(plugin).to receive(:iproute2_binary_available?).and_return( network_method == "iproute2" )
|
368
|
+
allow(plugin).to receive(:find_ethtool_binary).and_return( '/sbin/ethtool' )
|
331
369
|
plugin.run
|
332
370
|
end
|
333
371
|
|
@@ -340,6 +378,15 @@ fe80::21c:eff:fe12:3456 dev eth0.153 lladdr 00:1c:0e:30:28:00 router REACHABLE
|
|
340
378
|
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"])
|
341
379
|
end
|
342
380
|
|
381
|
+
it "detects the layer one details of an ethernet interface" do
|
382
|
+
expect(plugin['network']['interfaces']['eth0']['link_speed']).to eq(10000)
|
383
|
+
expect(plugin['network']['interfaces']['eth0']['duplex']).to eq('Full')
|
384
|
+
expect(plugin['network']['interfaces']['eth0']['port']).to eq('FIBRE')
|
385
|
+
expect(plugin['network']['interfaces']['eth0']['transceiver']).to eq('external')
|
386
|
+
expect(plugin['network']['interfaces']['eth0']['auto_negotiation']).to eq('on')
|
387
|
+
expect(plugin['network']['interfaces']['eth0']['mdi_x']).to be_nil
|
388
|
+
end
|
389
|
+
|
343
390
|
it "detects the ipv4 addresses of the ethernet interface" do
|
344
391
|
expect(plugin['network']['interfaces']['eth0']['addresses'].keys).to include('10.116.201.76')
|
345
392
|
expect(plugin['network']['interfaces']['eth0']['addresses']['10.116.201.76']['netmask']).to eq('255.255.255.0')
|
@@ -547,6 +594,7 @@ Destination Gateway Genmask Flags Metric Ref Use Iface
|
|
547
594
|
before(:each) do
|
548
595
|
allow(File).to receive(:exist?).with("/sbin/ip").and_return(true) # iproute2 only
|
549
596
|
allow(File).to receive(:exist?).with("/proc/net/if_inet6").and_return(true) # ipv6 is enabled
|
597
|
+
allow(File).to receive(:exist?).with("/sbin/ethtool").and_return(true) # ethtool is available
|
550
598
|
plugin.run
|
551
599
|
end
|
552
600
|
|
@@ -615,7 +663,14 @@ Destination Gateway Genmask Flags Metric Ref Use Iface
|
|
615
663
|
expect(plugin['network']['interfaces']['eth0.11']['routes']).to include Mash.new( :destination => "default", :via => "1111:2222:3333:4444::1", :metric => "1024", :family => "inet6")
|
616
664
|
end
|
617
665
|
|
618
|
-
describe "when there isn't a source field in route entries " do
|
666
|
+
describe "when there isn't a source field in route entries and no ipv6 default routes" do
|
667
|
+
let(:linux_ip_route_inet6) {
|
668
|
+
'fe80::/64 dev eth0 proto kernel metric 256
|
669
|
+
fe80::/64 dev eth0.11 proto kernel metric 256
|
670
|
+
1111:2222:3333:4444::/64 dev eth0.11 metric 1024 expires 86023sec
|
671
|
+
'
|
672
|
+
}
|
673
|
+
|
619
674
|
before(:each) do
|
620
675
|
plugin.run
|
621
676
|
end
|
@@ -750,7 +805,7 @@ default via 1111:2222:3333:4444::ffff dev eth0.11 metric 1023 src 1111:2222:333
|
|
750
805
|
end
|
751
806
|
end
|
752
807
|
|
753
|
-
describe "when there's a source field in a local route entry " do
|
808
|
+
describe "when there's a source field in a local route entry but it isnt in the default route" do
|
754
809
|
let(:linux_ip_route) {
|
755
810
|
'10.116.201.0/24 dev eth0 proto kernel src 10.116.201.76
|
756
811
|
192.168.5.0/24 dev eth0 proto kernel src 192.168.5.1
|
@@ -780,18 +835,34 @@ default via 1111:2222:3333:4444::1 dev eth0.11 metric 1024
|
|
780
835
|
expect(plugin['ipaddress']).to eq("10.116.201.76")
|
781
836
|
end
|
782
837
|
|
838
|
+
# without a source address on the default route we cannot pick the an ipv6 address from the interface
|
839
|
+
# In the future an RFC6724 compliant process should choose ip6address in the network plugin
|
840
|
+
it "does not set ip6address" do
|
841
|
+
plugin.run
|
842
|
+
expect(plugin['ip6address']).to eq(nil)
|
843
|
+
end
|
844
|
+
|
845
|
+
context "with only ipv6 routes" do
|
846
|
+
let(:linux_ip_route) { '' }
|
847
|
+
|
848
|
+
it "sets macaddress to the mac address of the ip6 default interface" do
|
849
|
+
expect(plugin['macaddress']).to eq("00:AA:BB:CC:DD:EE")
|
850
|
+
end
|
851
|
+
end
|
852
|
+
|
783
853
|
describe "when about to set macaddress" do
|
784
854
|
it "sets macaddress" do
|
785
855
|
plugin.run
|
786
856
|
expect(plugin['macaddress']).to eq("12:31:3D:02:BE:A2")
|
787
857
|
end
|
788
858
|
|
789
|
-
|
859
|
+
context "when then ipv4 interface has the NOARP flag and no ipv6 routes exist" do
|
790
860
|
let(:linux_ip_route) {
|
791
861
|
'10.118.19.1 dev tun0 proto kernel src 10.118.19.39
|
792
862
|
default via 172.16.19.1 dev tun0
|
793
863
|
'
|
794
864
|
}
|
865
|
+
let(:linux_ip_route_inet6) { '' }
|
795
866
|
|
796
867
|
it "completes the run" do
|
797
868
|
expect(Ohai::Log).not_to receive(:debug).with(/Plugin linux::network threw exception/)
|
@@ -805,11 +876,6 @@ default via 172.16.19.1 dev tun0
|
|
805
876
|
end
|
806
877
|
end
|
807
878
|
end
|
808
|
-
|
809
|
-
it "sets ip6address" do
|
810
|
-
plugin.run
|
811
|
-
expect(plugin['ip6address']).to eq("1111:2222:3333:4444::3")
|
812
|
-
end
|
813
879
|
end
|
814
880
|
|
815
881
|
describe "with a link level default route" do
|
@@ -902,6 +968,9 @@ fe80::/64 dev eth0.11 proto kernel metric 256
|
|
902
968
|
inet6 2001:44b8:4160:8f00:a00:27ff:fe13:eacd/64 scope global dynamic
|
903
969
|
valid_lft 6128sec preferred_lft 2526sec
|
904
970
|
'}
|
971
|
+
# We don't have the corresponding ipv6 data for these tests
|
972
|
+
let(:linux_ip_route_inet6) { '' }
|
973
|
+
let(:linux_ip_inet6_neighbor_show) { '' }
|
905
974
|
|
906
975
|
before(:each) do
|
907
976
|
allow(plugin).to receive(:is_openvz?).and_return true
|