ohai 15.3.1 → 15.6.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile +0 -6
- data/lib/ohai/mixin/{network_constants.rb → network_helper.rb} +8 -1
- data/lib/ohai/plugins/aix/network.rb +3 -8
- data/lib/ohai/plugins/darwin/network.rb +6 -4
- data/lib/ohai/plugins/filesystem.rb +166 -0
- data/lib/ohai/plugins/network.rb +5 -5
- data/lib/ohai/plugins/openstack.rb +2 -1
- data/lib/ohai/plugins/solaris2/network.rb +6 -4
- data/lib/ohai/version.rb +1 -1
- data/ohai.gemspec +1 -1
- metadata +3 -162
- data/Rakefile +0 -42
- data/lib/ohai/plugins/windows/filesystem.rb +0 -147
- data/spec/data/plugins/dpkg-query.output +0 -4
- data/spec/data/plugins/lslpp.output +0 -50
- data/spec/data/plugins/pacman.output +0 -51
- data/spec/data/plugins/pkg-query.output +0 -58
- data/spec/data/plugins/pkginfo.output +0 -50
- data/spec/data/plugins/pkglist.output +0 -24
- data/spec/data/plugins/rpmquery.output +0 -7
- data/spec/functional/application_spec.rb +0 -107
- data/spec/functional/loader_spec.rb +0 -53
- data/spec/functional/plugins/powershell_spec.rb +0 -88
- data/spec/functional/plugins/root_group_spec.rb +0 -41
- data/spec/functional/plugins/windows/uptime_spec.rb +0 -51
- data/spec/ohai_spec.rb +0 -27
- data/spec/rcov.opts +0 -2
- data/spec/spec.opts +0 -2
- data/spec/spec_helper.rb +0 -124
- data/spec/support/integration_helper.rb +0 -61
- data/spec/support/platform_helpers.rb +0 -38
- data/spec/unit/application_spec.rb +0 -96
- data/spec/unit/config_spec.rb +0 -57
- data/spec/unit/dsl/plugin_spec.rb +0 -634
- data/spec/unit/hints_spec.rb +0 -65
- data/spec/unit/loader_spec.rb +0 -195
- data/spec/unit/mixin/azure_metadata_spec.rb +0 -72
- data/spec/unit/mixin/command_spec.rb +0 -151
- data/spec/unit/mixin/dmi_decode.rb +0 -75
- data/spec/unit/mixin/ec2_metadata_spec.rb +0 -88
- data/spec/unit/mixin/softlayer_metadata_spec.rb +0 -72
- data/spec/unit/plugin_config_spec.rb +0 -117
- data/spec/unit/plugins/abort_spec.rb +0 -69
- data/spec/unit/plugins/aix/cpu_spec.rb +0 -127
- data/spec/unit/plugins/aix/filesystem_spec.rb +0 -238
- data/spec/unit/plugins/aix/hostname_spec.rb +0 -33
- data/spec/unit/plugins/aix/kernel_spec.rb +0 -61
- data/spec/unit/plugins/aix/memory_spec.rb +0 -49
- data/spec/unit/plugins/aix/network_spec.rb +0 -313
- data/spec/unit/plugins/aix/platform_spec.rb +0 -44
- data/spec/unit/plugins/aix/uptime_spec.rb +0 -42
- data/spec/unit/plugins/aix/virtualization_spec.rb +0 -319
- data/spec/unit/plugins/azure_spec.rb +0 -243
- data/spec/unit/plugins/bsd/filesystem_spec.rb +0 -138
- data/spec/unit/plugins/bsd/virtualization_spec.rb +0 -145
- data/spec/unit/plugins/c_spec.rb +0 -341
- data/spec/unit/plugins/chef_spec.rb +0 -44
- data/spec/unit/plugins/cloud_spec.rb +0 -484
- data/spec/unit/plugins/darwin/cpu_spec.rb +0 -124
- data/spec/unit/plugins/darwin/filesystem_spec.rb +0 -140
- data/spec/unit/plugins/darwin/hardware_spec.rb +0 -105
- data/spec/unit/plugins/darwin/hardware_system_profiler_output.rb +0 -1110
- data/spec/unit/plugins/darwin/hostname_spec.rb +0 -43
- data/spec/unit/plugins/darwin/kernel_spec.rb +0 -65
- data/spec/unit/plugins/darwin/memory_spec.rb +0 -64
- data/spec/unit/plugins/darwin/network_spec.rb +0 -849
- data/spec/unit/plugins/darwin/platform_spec.rb +0 -71
- data/spec/unit/plugins/darwin/virtualization_spec.rb +0 -156
- data/spec/unit/plugins/digital_ocean_spec.rb +0 -106
- data/spec/unit/plugins/dmi_spec.rb +0 -156
- data/spec/unit/plugins/docker_spec.rb +0 -100
- data/spec/unit/plugins/ec2_spec.rb +0 -452
- data/spec/unit/plugins/elixir_spec.rb +0 -55
- data/spec/unit/plugins/erlang_spec.rb +0 -71
- data/spec/unit/plugins/eucalyptus_spec.rb +0 -109
- data/spec/unit/plugins/fail_spec.rb +0 -260
- data/spec/unit/plugins/freebsd/cpu_spec.rb +0 -129
- data/spec/unit/plugins/freebsd/hostname_spec.rb +0 -35
- data/spec/unit/plugins/freebsd/kernel_spec.rb +0 -36
- data/spec/unit/plugins/freebsd/platform_spec.rb +0 -38
- data/spec/unit/plugins/gce_spec.rb +0 -81
- data/spec/unit/plugins/go_spec.rb +0 -48
- data/spec/unit/plugins/groovy_spec.rb +0 -66
- data/spec/unit/plugins/haskell_spec.rb +0 -231
- data/spec/unit/plugins/hostname_spec.rb +0 -162
- data/spec/unit/plugins/init_package_spec.rb +0 -60
- data/spec/unit/plugins/java_spec.rb +0 -230
- data/spec/unit/plugins/joyent_spec.rb +0 -100
- data/spec/unit/plugins/kernel_spec.rb +0 -38
- data/spec/unit/plugins/linode_spec.rb +0 -135
- data/spec/unit/plugins/linux/block_device_spec.rb +0 -75
- data/spec/unit/plugins/linux/cpu_spec.rb +0 -441
- data/spec/unit/plugins/linux/filesystem_spec.rb +0 -550
- data/spec/unit/plugins/linux/fips_spec.rb +0 -60
- data/spec/unit/plugins/linux/hostname_spec.rb +0 -52
- data/spec/unit/plugins/linux/hostnamectl_spec.rb +0 -59
- data/spec/unit/plugins/linux/kernel_spec.rb +0 -71
- data/spec/unit/plugins/linux/lsb_spec.rb +0 -147
- data/spec/unit/plugins/linux/lspci_spec.rb +0 -133
- data/spec/unit/plugins/linux/machineid_spec.rb +0 -46
- data/spec/unit/plugins/linux/mdadm_spec.rb +0 -170
- data/spec/unit/plugins/linux/memory_spec.rb +0 -256
- data/spec/unit/plugins/linux/network_spec.rb +0 -1392
- data/spec/unit/plugins/linux/platform_spec.rb +0 -812
- data/spec/unit/plugins/linux/sessions_spec.rb +0 -98
- data/spec/unit/plugins/linux/sysctl_spec.rb +0 -53
- data/spec/unit/plugins/linux/systemd_paths_spec.rb +0 -122
- data/spec/unit/plugins/linux/uptime_spec.rb +0 -48
- data/spec/unit/plugins/linux/virtualization_spec.rb +0 -650
- data/spec/unit/plugins/lua_spec.rb +0 -60
- data/spec/unit/plugins/mono_spec.rb +0 -67
- data/spec/unit/plugins/netbsd/hostname_spec.rb +0 -43
- data/spec/unit/plugins/netbsd/kernel_spec.rb +0 -35
- data/spec/unit/plugins/netbsd/platform_spec.rb +0 -38
- data/spec/unit/plugins/network_spec.rb +0 -1078
- data/spec/unit/plugins/nodejs_spec.rb +0 -55
- data/spec/unit/plugins/ohai_spec.rb +0 -32
- data/spec/unit/plugins/ohai_time_spec.rb +0 -44
- data/spec/unit/plugins/openbsd/hostname_spec.rb +0 -43
- data/spec/unit/plugins/openbsd/kernel_spec.rb +0 -36
- data/spec/unit/plugins/openbsd/platform_spec.rb +0 -33
- data/spec/unit/plugins/openstack_spec.rb +0 -311
- data/spec/unit/plugins/os_spec.rb +0 -115
- data/spec/unit/plugins/packages_spec.rb +0 -353
- data/spec/unit/plugins/passwd_spec.rb +0 -65
- data/spec/unit/plugins/perl_spec.rb +0 -62
- data/spec/unit/plugins/php_spec.rb +0 -97
- data/spec/unit/plugins/platform_spec.rb +0 -65
- data/spec/unit/plugins/powershell_spec.rb +0 -71
- data/spec/unit/plugins/python_spec.rb +0 -51
- data/spec/unit/plugins/rackspace_spec.rb +0 -350
- data/spec/unit/plugins/root_group_spec.rb +0 -90
- data/spec/unit/plugins/ruby_spec.rb +0 -60
- data/spec/unit/plugins/rust_spec.rb +0 -43
- data/spec/unit/plugins/scala_spec.rb +0 -58
- data/spec/unit/plugins/scaleway_spec.rb +0 -93
- data/spec/unit/plugins/scsi_spec.rb +0 -69
- data/spec/unit/plugins/shard_spec.rb +0 -121
- data/spec/unit/plugins/shells_spec.rb +0 -56
- data/spec/unit/plugins/softlayer_spec.rb +0 -60
- data/spec/unit/plugins/solaris2/cpu_spec.rb +0 -2926
- data/spec/unit/plugins/solaris2/dmi_spec.rb +0 -153
- data/spec/unit/plugins/solaris2/filesystem.rb +0 -407
- data/spec/unit/plugins/solaris2/hostname_spec.rb +0 -37
- data/spec/unit/plugins/solaris2/kernel_spec.rb +0 -183
- data/spec/unit/plugins/solaris2/memory_spec.rb +0 -43
- data/spec/unit/plugins/solaris2/network_spec.rb +0 -201
- data/spec/unit/plugins/solaris2/platform_spec.rb +0 -108
- data/spec/unit/plugins/solaris2/virtualization_spec.rb +0 -97
- data/spec/unit/plugins/ssh_host_keys_spec.rb +0 -116
- data/spec/unit/plugins/sysconf_spec.rb +0 -680
- data/spec/unit/plugins/timezone_spec.rb +0 -30
- data/spec/unit/plugins/vbox_host_spec.rb +0 -14
- data/spec/unit/plugins/virtualbox_spec.rb +0 -375
- data/spec/unit/plugins/vmware_spec.rb +0 -81
- data/spec/unit/plugins/windows/cpu_spec.rb +0 -118
- data/spec/unit/plugins/windows/filesystem_spec.rb +0 -226
- data/spec/unit/plugins/windows/fips_spec.rb +0 -60
- data/spec/unit/plugins/windows/kernel_spec.rb +0 -79
- data/spec/unit/plugins/windows/memory_spec.rb +0 -52
- data/spec/unit/plugins/windows/network_spec.rb +0 -137
- data/spec/unit/plugins/windows/system_enclosure_spec.rb +0 -45
- data/spec/unit/plugins/windows/uptime_spec.rb +0 -38
- data/spec/unit/plugins/windows/virtualization_spec.rb +0 -63
- data/spec/unit/plugins/zpools_spec.rb +0 -244
- data/spec/unit/provides_map_spec.rb +0 -208
- data/spec/unit/runner_spec.rb +0 -422
- data/spec/unit/system_spec.rb +0 -416
- data/spec/unit/util/file_helper_spec.rb +0 -47
- data/spec/unit/util/ip_helper_spec.rb +0 -128
@@ -1,60 +0,0 @@
|
|
1
|
-
#
|
2
|
-
# Author:: Matt Wrock (<matt@mattwrock.com>)
|
3
|
-
# Copyright:: Copyright (c) 2016-2018 Chef Software, Inc.
|
4
|
-
# License:: Apache License, Version 2.0
|
5
|
-
#
|
6
|
-
# Licensed under the Apache License, Version 2.0 (the "License");
|
7
|
-
# you may not use this file except in compliance with the License.
|
8
|
-
# You may obtain a copy of the License at
|
9
|
-
#
|
10
|
-
# http://www.apache.org/licenses/LICENSE-2.0
|
11
|
-
#
|
12
|
-
# Unless required by applicable law or agreed to in writing, software
|
13
|
-
# distributed under the License is distributed on an "AS IS" BASIS,
|
14
|
-
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
15
|
-
# See the License for the specific language governing permissions and
|
16
|
-
# limitations under the License.
|
17
|
-
#
|
18
|
-
|
19
|
-
require "spec_helper"
|
20
|
-
require "openssl"
|
21
|
-
|
22
|
-
describe Ohai::System, "plugin fips" do
|
23
|
-
subject do
|
24
|
-
plugin.run
|
25
|
-
plugin["fips"]["kernel"]["enabled"]
|
26
|
-
end
|
27
|
-
|
28
|
-
let(:enabled) { "0" }
|
29
|
-
let(:plugin) { get_plugin("linux/fips") }
|
30
|
-
let(:openssl_test_mode) { false }
|
31
|
-
|
32
|
-
before do
|
33
|
-
allow(plugin).to receive(:collect_os).and_return(:linux)
|
34
|
-
end
|
35
|
-
|
36
|
-
around do |ex|
|
37
|
-
|
38
|
-
$FIPS_TEST_MODE = openssl_test_mode
|
39
|
-
ex.run
|
40
|
-
ensure
|
41
|
-
$FIPS_TEST_MODE = false
|
42
|
-
|
43
|
-
end
|
44
|
-
|
45
|
-
context "with OpenSSL.fips_mode == false" do
|
46
|
-
before { allow(OpenSSL).to receive(:fips_mode).and_return(false) }
|
47
|
-
|
48
|
-
it "does not set fips plugin" do
|
49
|
-
expect(subject).to be(false)
|
50
|
-
end
|
51
|
-
end
|
52
|
-
|
53
|
-
context "with OpenSSL.fips_mode == true" do
|
54
|
-
before { allow(OpenSSL).to receive(:fips_mode).and_return(true) }
|
55
|
-
|
56
|
-
it "sets fips plugin" do
|
57
|
-
expect(subject).to be(true)
|
58
|
-
end
|
59
|
-
end
|
60
|
-
end
|
@@ -1,52 +0,0 @@
|
|
1
|
-
#
|
2
|
-
# Author:: Adam Jacob (<adam@chef.io>)
|
3
|
-
# Copyright:: Copyright (c) 2008-2016 Chef Software, Inc.
|
4
|
-
# License:: Apache License, Version 2.0
|
5
|
-
#
|
6
|
-
# Licensed under the Apache License, Version 2.0 (the "License");
|
7
|
-
# you may not use this file except in compliance with the License.
|
8
|
-
# You may obtain a copy of the License at
|
9
|
-
#
|
10
|
-
# http://www.apache.org/licenses/LICENSE-2.0
|
11
|
-
#
|
12
|
-
# Unless required by applicable law or agreed to in writing, software
|
13
|
-
# distributed under the License is distributed on an "AS IS" BASIS,
|
14
|
-
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
15
|
-
# See the License for the specific language governing permissions and
|
16
|
-
# limitations under the License.
|
17
|
-
#
|
18
|
-
|
19
|
-
require "spec_helper"
|
20
|
-
|
21
|
-
describe Ohai::System, "Linux hostname plugin" do
|
22
|
-
before do
|
23
|
-
@plugin = get_plugin("hostname")
|
24
|
-
allow(@plugin).to receive(:collect_os).and_return(:linux)
|
25
|
-
allow(@plugin).to receive(:shell_out).with("hostname -s").and_return(mock_shell_out(0, "katie", ""))
|
26
|
-
allow(@plugin).to receive(:shell_out).with("hostname --fqdn").and_return(mock_shell_out(0, "katie.bethell", ""))
|
27
|
-
allow(@plugin).to receive(:shell_out).with("hostname").and_return(mock_shell_out(0, "katie.local", ""))
|
28
|
-
end
|
29
|
-
|
30
|
-
it_should_check_from("linux::hostname", "hostname", "hostname -s", "katie")
|
31
|
-
|
32
|
-
it_should_check_from("linux::hostname", "fqdn", "hostname --fqdn", "katie.bethell")
|
33
|
-
|
34
|
-
it_should_check_from("linux::hostname", "machinename", "hostname", "katie.local")
|
35
|
-
|
36
|
-
describe "when domain name is unset" do
|
37
|
-
before do
|
38
|
-
expect(@plugin).to receive(:shell_out).with("hostname --fqdn").and_raise("Ohai::Exception::Exec")
|
39
|
-
end
|
40
|
-
|
41
|
-
it "does not raise an error" do
|
42
|
-
expect { @plugin.run }.not_to raise_error
|
43
|
-
end
|
44
|
-
|
45
|
-
it "does not set fqdn" do
|
46
|
-
@plugin.run
|
47
|
-
expect(@plugin.fqdn).to eq(nil)
|
48
|
-
end
|
49
|
-
|
50
|
-
end
|
51
|
-
|
52
|
-
end
|
@@ -1,59 +0,0 @@
|
|
1
|
-
#
|
2
|
-
# Author:: Davide Cavalca <dcavalca@fb.com>
|
3
|
-
# Copyright:: Copyright (c) 2016 Facebook
|
4
|
-
# License:: Apache License, Version 2.0
|
5
|
-
#
|
6
|
-
# Licensed under the Apache License, Version 2.0 (the "License");
|
7
|
-
# you may not use this file except in compliance with the License.
|
8
|
-
# You may obtain a copy of the License at
|
9
|
-
#
|
10
|
-
# http://www.apache.org/licenses/LICENSE-2.0
|
11
|
-
#
|
12
|
-
# Unless required by applicable law or agreed to in writing, software
|
13
|
-
# distributed under the License is distributed on an "AS IS" BASIS,
|
14
|
-
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
15
|
-
# See the License for the specific language governing permissions and
|
16
|
-
# limitations under the License.
|
17
|
-
#
|
18
|
-
|
19
|
-
require "spec_helper"
|
20
|
-
|
21
|
-
describe Ohai::System, "Linux hostnamectl plugin" do
|
22
|
-
let(:plugin) { get_plugin("linux/hostnamectl") }
|
23
|
-
|
24
|
-
before do
|
25
|
-
allow(plugin).to receive(:collect_os).and_return(:linux)
|
26
|
-
end
|
27
|
-
|
28
|
-
it "populates hostnamectl if hostnamectl is available" do
|
29
|
-
hostnamectl_out = <<-HOSTNAMECTL_OUT
|
30
|
-
Static hostname: foo
|
31
|
-
Icon name: computer-laptop
|
32
|
-
Chassis: laptop
|
33
|
-
Machine ID: 6f702523e2fc7499eb1dc68e5314dacf
|
34
|
-
Boot ID: e085ae9e65e245a8a7b62912adeebe97
|
35
|
-
Operating System: Debian GNU/Linux 8 (jessie)
|
36
|
-
Kernel: Linux 4.3.0-0.bpo.1-amd64
|
37
|
-
Architecture: x86-64
|
38
|
-
HOSTNAMECTL_OUT
|
39
|
-
|
40
|
-
allow(plugin).to receive(:which).with("hostnamectl").and_return("/bin/hostnamectl")
|
41
|
-
allow(plugin).to receive(:shell_out).with("/bin/hostnamectl").and_return(mock_shell_out(0, hostnamectl_out, ""))
|
42
|
-
plugin.run
|
43
|
-
expect(plugin[:hostnamectl].to_hash).to eq({
|
44
|
-
"static_hostname" => "foo",
|
45
|
-
"icon_name" => "computer-laptop",
|
46
|
-
"chassis" => "laptop",
|
47
|
-
"machine_id" => "6f702523e2fc7499eb1dc68e5314dacf",
|
48
|
-
"boot_id" => "e085ae9e65e245a8a7b62912adeebe97",
|
49
|
-
"operating_system" => "Debian GNU/Linux 8 (jessie)",
|
50
|
-
"kernel" => "Linux 4.3.0-0.bpo.1-amd64",
|
51
|
-
"architecture" => "x86-64",
|
52
|
-
})
|
53
|
-
end
|
54
|
-
|
55
|
-
it "does not populate hostnamectl if hostnamectl is not available" do
|
56
|
-
allow(plugin).to receive(:which).with("hostnamectl").and_return(false)
|
57
|
-
expect(plugin[:hostnamectl]).to eq(nil)
|
58
|
-
end
|
59
|
-
end
|
@@ -1,71 +0,0 @@
|
|
1
|
-
#
|
2
|
-
# Author:: Adam Jacob (<adam@chef.io>)
|
3
|
-
# Author:: Theodore Nordsieck (<theo@chef.io>)
|
4
|
-
# Copyright:: Copyright (c) 2008-2016 Chef Software, Inc.
|
5
|
-
# License:: Apache License, Version 2.0
|
6
|
-
#
|
7
|
-
# Licensed under the Apache License, Version 2.0 (the "License");
|
8
|
-
# you may not use this file except in compliance with the License.
|
9
|
-
# You may obtain a copy of the License at
|
10
|
-
#
|
11
|
-
# http://www.apache.org/licenses/LICENSE-2.0
|
12
|
-
#
|
13
|
-
# Unless required by applicable law or agreed to in writing, software
|
14
|
-
# distributed under the License is distributed on an "AS IS" BASIS,
|
15
|
-
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
16
|
-
# See the License for the specific language governing permissions and
|
17
|
-
# limitations under the License.
|
18
|
-
#
|
19
|
-
|
20
|
-
require "spec_helper"
|
21
|
-
|
22
|
-
describe Ohai::System, "Linux kernel plugin" do
|
23
|
-
before do
|
24
|
-
@env_lsmod = <<~ENV_LSMOD
|
25
|
-
Module Size Used by
|
26
|
-
dm_crypt 22321 0
|
27
|
-
psmouse 81038 0
|
28
|
-
acpiphp 23314 0
|
29
|
-
microcode 18286 0
|
30
|
-
serio_raw 13031 0
|
31
|
-
virtio_balloon 13168 0
|
32
|
-
floppy 55441 0
|
33
|
-
ENV_LSMOD
|
34
|
-
@version_module = {
|
35
|
-
dm_crypt: "",
|
36
|
-
psmouse: "",
|
37
|
-
acpiphp: "",
|
38
|
-
microcode: "1.2.3",
|
39
|
-
serio_raw: "",
|
40
|
-
virtio_balloon: "",
|
41
|
-
floppy: "",
|
42
|
-
}
|
43
|
-
|
44
|
-
@expected_result = {
|
45
|
-
"dm_crypt" => { "size" => "22321", "refcount" => "0" },
|
46
|
-
"psmouse" => { "size" => "81038", "refcount" => "0" },
|
47
|
-
"acpiphp" => { "size" => "23314", "refcount" => "0" },
|
48
|
-
"microcode" => { "size" => "18286", "refcount" => "0", "version" => "1.2.3" },
|
49
|
-
"serio_raw" => { "size" => "13031", "refcount" => "0" },
|
50
|
-
"virtio_balloon" => { "size" => "13168", "refcount" => "0" },
|
51
|
-
"floppy" => { "size" => "55441", "refcount" => "0" },
|
52
|
-
}
|
53
|
-
@plugin = get_plugin("kernel")
|
54
|
-
allow(@plugin).to receive(:collect_os).and_return(:linux)
|
55
|
-
allow(@plugin).to receive(:init_kernel).and_return({})
|
56
|
-
allow(@plugin).to receive(:shell_out).with("uname -o").and_return(mock_shell_out(0, "Linux", ""))
|
57
|
-
allow(@plugin).to receive(:shell_out).with("env lsmod").and_return(mock_shell_out(0, @env_lsmod, ""))
|
58
|
-
@version_module.each do |mod, vers|
|
59
|
-
allow(File).to receive(:exist?).with("/sys/module/#{mod}/version").and_return(true)
|
60
|
-
allow(File).to receive(:read).with("/sys/module/#{mod}/version").and_return(vers)
|
61
|
-
end
|
62
|
-
expect(@plugin).to receive(:shell_out).with("env lsmod").at_least(1).times
|
63
|
-
@plugin.run
|
64
|
-
end
|
65
|
-
|
66
|
-
it_should_check_from_deep_mash("linux::kernel", "kernel", "os", "uname -o", [0, "Linux", ""])
|
67
|
-
|
68
|
-
it "collects linux::kernel::modules" do
|
69
|
-
expect(@plugin.data["kernel"]["modules"]).to eq(@expected_result)
|
70
|
-
end
|
71
|
-
end
|
@@ -1,147 +0,0 @@
|
|
1
|
-
#
|
2
|
-
# Author:: Adam Jacob (<adam@chef.io>)
|
3
|
-
# Copyright:: Copyright (c) 2008-2016 Chef Software, Inc.
|
4
|
-
# License:: Apache License, Version 2.0
|
5
|
-
#
|
6
|
-
# Licensed under the Apache License, Version 2.0 (the "License");
|
7
|
-
# you may not use this file except in compliance with the License.
|
8
|
-
# You may obtain a copy of the License at
|
9
|
-
#
|
10
|
-
# http://www.apache.org/licenses/LICENSE-2.0
|
11
|
-
#
|
12
|
-
# Unless required by applicable law or agreed to in writing, software
|
13
|
-
# distributed under the License is distributed on an "AS IS" BASIS,
|
14
|
-
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
15
|
-
# See the License for the specific language governing permissions and
|
16
|
-
# limitations under the License.
|
17
|
-
#
|
18
|
-
|
19
|
-
require "spec_helper"
|
20
|
-
|
21
|
-
# We do not alter case for lsb attributes and consume them as provided
|
22
|
-
|
23
|
-
describe Ohai::System, "Linux lsb plugin" do
|
24
|
-
before do
|
25
|
-
@plugin = get_plugin("linux/lsb")
|
26
|
-
allow(@plugin).to receive(:collect_os).and_return(:linux)
|
27
|
-
end
|
28
|
-
|
29
|
-
describe "on systems with /etc/lsb-release" do
|
30
|
-
before do
|
31
|
-
@double_file = double("/etc/lsb-release")
|
32
|
-
allow(@double_file).to receive(:each)
|
33
|
-
.and_yield("DISTRIB_ID=Ubuntu")
|
34
|
-
.and_yield("DISTRIB_RELEASE=8.04")
|
35
|
-
.and_yield("DISTRIB_CODENAME=hardy")
|
36
|
-
.and_yield('DISTRIB_DESCRIPTION="Ubuntu 8.04"')
|
37
|
-
allow(File).to receive(:open).with("/etc/lsb-release").and_return(@double_file)
|
38
|
-
allow(File).to receive(:exist?).with("/usr/bin/lsb_release").and_return(false)
|
39
|
-
allow(File).to receive(:exist?).with("/etc/lsb-release").and_return(true)
|
40
|
-
end
|
41
|
-
|
42
|
-
it "sets lsb[:id]" do
|
43
|
-
@plugin.run
|
44
|
-
expect(@plugin[:lsb][:id]).to eq("Ubuntu")
|
45
|
-
end
|
46
|
-
|
47
|
-
it "sets lsb[:release]" do
|
48
|
-
@plugin.run
|
49
|
-
expect(@plugin[:lsb][:release]).to eq("8.04")
|
50
|
-
end
|
51
|
-
|
52
|
-
it "sets lsb[:codename]" do
|
53
|
-
@plugin.run
|
54
|
-
expect(@plugin[:lsb][:codename]).to eq("hardy")
|
55
|
-
end
|
56
|
-
|
57
|
-
it "sets lsb[:description]" do
|
58
|
-
@plugin.run
|
59
|
-
expect(@plugin[:lsb][:description]).to eq("Ubuntu 8.04")
|
60
|
-
end
|
61
|
-
end
|
62
|
-
|
63
|
-
describe "on systems with /usr/bin/lsb_release" do
|
64
|
-
before do
|
65
|
-
allow(File).to receive(:exist?).with("/usr/bin/lsb_release").and_return(true)
|
66
|
-
|
67
|
-
@stdin = double("STDIN", { close: true })
|
68
|
-
@pid = 10
|
69
|
-
@stderr = double("STDERR")
|
70
|
-
@stdout = double("STDOUT")
|
71
|
-
@status = 0
|
72
|
-
|
73
|
-
end
|
74
|
-
|
75
|
-
describe "on Centos 5.4 correctly" do
|
76
|
-
before do
|
77
|
-
@stdout = <<~LSB_RELEASE
|
78
|
-
LSB Version: :core-3.1-ia32:core-3.1-noarch:graphics-3.1-ia32:graphics-3.1-noarch
|
79
|
-
Distributor ID: CentOS
|
80
|
-
Description: CentOS release 5.4 (Final)
|
81
|
-
Release: 5.4
|
82
|
-
Codename: Final
|
83
|
-
LSB_RELEASE
|
84
|
-
allow(@plugin).to receive(:shell_out).with("lsb_release -a").and_return(mock_shell_out(0, @stdout, ""))
|
85
|
-
end
|
86
|
-
|
87
|
-
it "sets lsb[:id]" do
|
88
|
-
@plugin.run
|
89
|
-
expect(@plugin[:lsb][:id]).to eq("CentOS")
|
90
|
-
end
|
91
|
-
|
92
|
-
it "sets lsb[:release]" do
|
93
|
-
@plugin.run
|
94
|
-
expect(@plugin[:lsb][:release]).to eq("5.4")
|
95
|
-
end
|
96
|
-
|
97
|
-
it "sets lsb[:codename]" do
|
98
|
-
@plugin.run
|
99
|
-
expect(@plugin[:lsb][:codename]).to eq("Final")
|
100
|
-
end
|
101
|
-
|
102
|
-
it "sets lsb[:description]" do
|
103
|
-
@plugin.run
|
104
|
-
expect(@plugin[:lsb][:description]).to eq("CentOS release 5.4 (Final)")
|
105
|
-
end
|
106
|
-
end
|
107
|
-
|
108
|
-
describe "on Fedora 14 correctly" do
|
109
|
-
before do
|
110
|
-
@stdout = <<~LSB_RELEASE
|
111
|
-
LSB Version: :core-4.0-ia32:core-4.0-noarch
|
112
|
-
Distributor ID: Fedora
|
113
|
-
Description: Fedora release 14 (Laughlin)
|
114
|
-
Release: 14
|
115
|
-
Codename: Laughlin
|
116
|
-
LSB_RELEASE
|
117
|
-
allow(@plugin).to receive(:shell_out).with("lsb_release -a").and_return(mock_shell_out(0, @stdout, ""))
|
118
|
-
end
|
119
|
-
|
120
|
-
it "sets lsb[:id]" do
|
121
|
-
@plugin.run
|
122
|
-
expect(@plugin[:lsb][:id]).to eq("Fedora")
|
123
|
-
end
|
124
|
-
|
125
|
-
it "sets lsb[:release]" do
|
126
|
-
@plugin.run
|
127
|
-
expect(@plugin[:lsb][:release]).to eq("14")
|
128
|
-
end
|
129
|
-
|
130
|
-
it "sets lsb[:codename]" do
|
131
|
-
@plugin.run
|
132
|
-
expect(@plugin[:lsb][:codename]).to eq("Laughlin")
|
133
|
-
end
|
134
|
-
|
135
|
-
it "sets lsb[:description]" do
|
136
|
-
@plugin.run
|
137
|
-
expect(@plugin[:lsb][:description]).to eq("Fedora release 14 (Laughlin)")
|
138
|
-
end
|
139
|
-
end
|
140
|
-
end
|
141
|
-
|
142
|
-
it "does not set any lsb values if /etc/lsb-release or /usr/bin/lsb_release do not exist " do
|
143
|
-
allow(File).to receive(:exist?).with("/etc/lsb-release").and_return(false)
|
144
|
-
allow(File).to receive(:exist?).with("/usr/bin/lsb_release").and_return(false)
|
145
|
-
expect(@plugin.attribute?(:lsb)).to be(false)
|
146
|
-
end
|
147
|
-
end
|
@@ -1,133 +0,0 @@
|
|
1
|
-
#
|
2
|
-
# Author:: Phil Dibowitz <phil@ipom.com>
|
3
|
-
# Copyright:: Copyright (c) 2017 Facebook, Inc.
|
4
|
-
# License:: Apache License, Version 2.0
|
5
|
-
#
|
6
|
-
# Licensed under the Apache License, Version 2.0 (the "License");
|
7
|
-
# you may not use this file except in compliance with the License.
|
8
|
-
# You may obtain a copy of the License at
|
9
|
-
#
|
10
|
-
# http://www.apache.org/licenses/LICENSE-2.0
|
11
|
-
#
|
12
|
-
# Unless required by applicable law or agreed to in writing, software
|
13
|
-
# distributed under the License is distributed on an "AS IS" BASIS,
|
14
|
-
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
15
|
-
# See the License for the specific language governing permissions and
|
16
|
-
# limitations under the License.
|
17
|
-
#
|
18
|
-
|
19
|
-
require "spec_helper"
|
20
|
-
|
21
|
-
describe Ohai::System, "Linux lspci plugin" do
|
22
|
-
let(:plugin) { get_plugin("linux/lspci") }
|
23
|
-
|
24
|
-
before do
|
25
|
-
allow(plugin).to receive(:collect_os).and_return(:linux)
|
26
|
-
@stdout = <<~LSPCI
|
27
|
-
Device: 00:1f.3
|
28
|
-
Class: Audio device [0403]
|
29
|
-
Vendor: Intel Corporation [8086]
|
30
|
-
Device: Sunrise Point-LP HD Audio [9d71]
|
31
|
-
SVendor: Lenovo [17aa]
|
32
|
-
SDevice: Sunrise Point-LP HD Audio [224e]
|
33
|
-
Rev: 21
|
34
|
-
Driver: snd_hda_intel
|
35
|
-
Module: snd_hda_intel
|
36
|
-
Module: snd_soc_skl
|
37
|
-
|
38
|
-
Device: 00:1f.4
|
39
|
-
Class: SMBus [0c05]
|
40
|
-
Vendor: Intel Corporation [8086]
|
41
|
-
Device: Sunrise Point-LP SMBus [9d23]
|
42
|
-
SVendor: Lenovo [17aa]
|
43
|
-
SDevice: Sunrise Point-LP SMBus [224e]
|
44
|
-
Rev: 21
|
45
|
-
Driver: i801_smbus
|
46
|
-
Module: i2c_i801
|
47
|
-
|
48
|
-
Device: 00:1f.6
|
49
|
-
Class: Ethernet controller [0200]
|
50
|
-
Vendor: Intel Corporation [8086]
|
51
|
-
Device: Ethernet Connection (4) I219-LM [15d7]
|
52
|
-
SVendor: Lenovo [17aa]
|
53
|
-
SDevice: Ethernet Connection (4) I219-LM [224e]
|
54
|
-
Rev: 21
|
55
|
-
Driver: e1000e
|
56
|
-
Module: e1000e
|
57
|
-
|
58
|
-
Device: 02:00.0
|
59
|
-
Class: Unassigned class [ff00]
|
60
|
-
Vendor: Realtek Semiconductor Co., Ltd. [10ec]
|
61
|
-
Device: RTS525A PCI Express Card Reader [525a]
|
62
|
-
SVendor: Lenovo [17aa]
|
63
|
-
SDevice: RTS525A PCI Express Card Reader [224e]
|
64
|
-
Rev: 01
|
65
|
-
Driver: rtsx_pci
|
66
|
-
Module: rtsx_pci
|
67
|
-
|
68
|
-
Device: 04:00.0
|
69
|
-
Class: Network controller [0280]
|
70
|
-
Vendor: Intel Corporation [8086]
|
71
|
-
Device: Wireless 8265 / 8275 [24fd]
|
72
|
-
SVendor: Intel Corporation [8086]
|
73
|
-
SDevice: Wireless 8265 / 8275 [0130]
|
74
|
-
Rev: 88
|
75
|
-
Driver: iwlwifi
|
76
|
-
Module: iwlwifi
|
77
|
-
|
78
|
-
Device: 05:00.0
|
79
|
-
Class: Non-Volatile memory controller [0108]
|
80
|
-
Vendor: Toshiba America Info Systems [1179]
|
81
|
-
Device: Device [0115]
|
82
|
-
SVendor: Toshiba America Info Systems [1179]
|
83
|
-
SDevice: Device [0001]
|
84
|
-
Rev: 01
|
85
|
-
ProgIf: 02
|
86
|
-
Driver: nvme
|
87
|
-
Module: nvme
|
88
|
-
NUMANode: 0
|
89
|
-
LSPCI
|
90
|
-
allow(plugin).to receive(:shell_out).with("lspci -vnnmk").and_return(
|
91
|
-
mock_shell_out(0, @stdout, "")
|
92
|
-
)
|
93
|
-
end
|
94
|
-
|
95
|
-
describe "when gathering data from lspci" do
|
96
|
-
it "lists all devices" do
|
97
|
-
plugin.run
|
98
|
-
expect(plugin[:pci].keys).to eq(
|
99
|
-
["00:1f.3", "00:1f.4", "00:1f.6", "02:00.0", "04:00.0", "05:00.0"]
|
100
|
-
)
|
101
|
-
end
|
102
|
-
|
103
|
-
it "parses out device name vs id" do
|
104
|
-
plugin.run
|
105
|
-
expect(plugin[:pci]["04:00.0"]["device_name"]).to eq("Wireless 8265 / 8275")
|
106
|
-
expect(plugin[:pci]["04:00.0"]["device_id"]).to eq("24fd")
|
107
|
-
end
|
108
|
-
|
109
|
-
it "parses out sdevice name vs id" do
|
110
|
-
plugin.run
|
111
|
-
expect(plugin[:pci]["04:00.0"]["sdevice_name"]).to eq("Wireless 8265 / 8275")
|
112
|
-
expect(plugin[:pci]["04:00.0"]["sdevice_id"]).to eq("0130")
|
113
|
-
end
|
114
|
-
|
115
|
-
it "parses out class name vs id" do
|
116
|
-
plugin.run
|
117
|
-
expect(plugin[:pci]["04:00.0"]["class_name"]).to eq("Network controller")
|
118
|
-
expect(plugin[:pci]["04:00.0"]["class_id"]).to eq("0280")
|
119
|
-
end
|
120
|
-
|
121
|
-
it "parses out vendor name vs id" do
|
122
|
-
plugin.run
|
123
|
-
expect(plugin[:pci]["04:00.0"]["vendor_name"]).to eq("Intel Corporation")
|
124
|
-
expect(plugin[:pci]["04:00.0"]["vendor_id"]).to eq("8086")
|
125
|
-
end
|
126
|
-
|
127
|
-
it "provides drivers and modules" do
|
128
|
-
plugin.run
|
129
|
-
expect(plugin[:pci]["04:00.0"]["driver"]).to eq(["iwlwifi"])
|
130
|
-
expect(plugin[:pci]["04:00.0"]["module"]).to eq(["iwlwifi"])
|
131
|
-
end
|
132
|
-
end
|
133
|
-
end
|