ohai 8.10.0 → 8.11.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile +1 -2
- data/Rakefile +13 -4
- data/bin/ohai +3 -4
- data/lib/ohai.rb +4 -4
- data/lib/ohai/application.rb +7 -6
- data/lib/ohai/common/dmi.rb +56 -56
- data/lib/ohai/config.rb +12 -8
- data/lib/ohai/dsl.rb +3 -3
- data/lib/ohai/dsl/plugin.rb +5 -5
- data/lib/ohai/dsl/plugin/versionvi.rb +0 -1
- data/lib/ohai/dsl/plugin/versionvii.rb +1 -0
- data/lib/ohai/hints.rb +1 -1
- data/lib/ohai/loader.rb +7 -7
- data/lib/ohai/log.rb +1 -1
- data/lib/ohai/mash.rb +3 -2
- data/lib/ohai/mixin/command.rb +25 -23
- data/lib/ohai/mixin/dmi_decode.rb +10 -10
- data/lib/ohai/mixin/ec2_metadata.rb +40 -39
- data/lib/ohai/mixin/gce_metadata.rb +9 -9
- data/lib/ohai/mixin/network_constants.rb +1 -1
- data/lib/ohai/mixin/os.rb +3 -3
- data/lib/ohai/mixin/seconds_to_human.rb +0 -2
- data/lib/ohai/mixin/softlayer_metadata.rb +10 -10
- data/lib/ohai/mixin/string.rb +2 -2
- data/lib/ohai/plugin_config.rb +1 -1
- data/lib/ohai/plugins/aix/cpu.rb +2 -2
- data/lib/ohai/plugins/aix/filesystem.rb +2 -2
- data/lib/ohai/plugins/aix/memory.rb +2 -2
- data/lib/ohai/plugins/aix/network.rb +9 -10
- data/lib/ohai/plugins/aix/os.rb +2 -2
- data/lib/ohai/plugins/aix/uptime.rb +3 -3
- data/lib/ohai/plugins/aix/virtualization.rb +23 -23
- data/lib/ohai/plugins/azure.rb +32 -5
- data/lib/ohai/plugins/bsd/virtualization.rb +22 -22
- data/lib/ohai/plugins/c.rb +3 -3
- data/lib/ohai/plugins/chef.rb +1 -1
- data/lib/ohai/plugins/cloud.rb +59 -60
- data/lib/ohai/plugins/cloud_v2.rb +37 -39
- data/lib/ohai/plugins/darwin/cpu.rb +1 -1
- data/lib/ohai/plugins/darwin/filesystem2.rb +5 -5
- data/lib/ohai/plugins/darwin/memory.rb +5 -6
- data/lib/ohai/plugins/darwin/network.rb +7 -7
- data/lib/ohai/plugins/darwin/system_profiler.rb +32 -33
- data/lib/ohai/plugins/darwin/virtualization.rb +9 -9
- data/lib/ohai/plugins/digital_ocean.rb +16 -16
- data/lib/ohai/plugins/dmi.rb +6 -6
- data/lib/ohai/plugins/dragonflybsd/cpu.rb +2 -2
- data/lib/ohai/plugins/dragonflybsd/memory.rb +0 -1
- data/lib/ohai/plugins/dragonflybsd/network.rb +4 -4
- data/lib/ohai/plugins/dragonflybsd/os.rb +1 -1
- data/lib/ohai/plugins/ec2.rb +39 -15
- data/lib/ohai/plugins/elixir.rb +1 -1
- data/lib/ohai/plugins/erlang.rb +3 -3
- data/lib/ohai/plugins/eucalyptus.rb +16 -12
- data/lib/ohai/plugins/freebsd/cpu.rb +2 -2
- data/lib/ohai/plugins/freebsd/memory.rb +0 -1
- data/lib/ohai/plugins/freebsd/network.rb +4 -4
- data/lib/ohai/plugins/freebsd/os.rb +1 -1
- data/lib/ohai/plugins/gce.rb +6 -6
- data/lib/ohai/plugins/hostname.rb +7 -7
- data/lib/ohai/plugins/init_package.rb +1 -1
- data/lib/ohai/plugins/ip_scopes.rb +9 -9
- data/lib/ohai/plugins/java.rb +1 -1
- data/lib/ohai/plugins/joyent.rb +7 -7
- data/lib/ohai/plugins/kernel.rb +8 -8
- data/lib/ohai/plugins/linode.rb +7 -4
- data/lib/ohai/plugins/linux/cpu.rb +5 -5
- data/lib/ohai/plugins/linux/filesystem.rb +16 -16
- data/lib/ohai/plugins/linux/filesystem2.rb +15 -15
- data/lib/ohai/plugins/linux/mdadm.rb +3 -3
- data/lib/ohai/plugins/linux/network.rb +85 -51
- data/lib/ohai/plugins/linux/platform.rb +24 -24
- data/lib/ohai/plugins/linux/virtualization.rb +8 -8
- data/lib/ohai/plugins/mono.rb +1 -1
- data/lib/ohai/plugins/netbsd/cpu.rb +1 -1
- data/lib/ohai/plugins/netbsd/network.rb +2 -2
- data/lib/ohai/plugins/network.rb +11 -11
- data/lib/ohai/plugins/network_listeners.rb +30 -26
- data/lib/ohai/plugins/ohai.rb +3 -3
- data/lib/ohai/plugins/openbsd/cpu.rb +4 -4
- data/lib/ohai/plugins/openbsd/memory.rb +4 -4
- data/lib/ohai/plugins/openbsd/network.rb +3 -3
- data/lib/ohai/plugins/openstack.rb +12 -12
- data/lib/ohai/plugins/os.rb +2 -2
- data/lib/ohai/plugins/packages.rb +22 -22
- data/lib/ohai/plugins/passwd.rb +4 -4
- data/lib/ohai/plugins/powershell.rb +9 -9
- data/lib/ohai/plugins/ps.rb +2 -2
- data/lib/ohai/plugins/python.rb +1 -1
- data/lib/ohai/plugins/rackspace.rb +13 -13
- data/lib/ohai/plugins/root_group.rb +4 -4
- data/lib/ohai/plugins/ruby.rb +6 -6
- data/lib/ohai/plugins/rust.rb +1 -1
- data/lib/ohai/plugins/sigar/cpu.rb +1 -1
- data/lib/ohai/plugins/sigar/filesystem.rb +1 -1
- data/lib/ohai/plugins/sigar/network.rb +13 -13
- data/lib/ohai/plugins/sigar/network_route.rb +34 -29
- data/lib/ohai/plugins/softlayer.rb +8 -7
- data/lib/ohai/plugins/solaris2/cpu.rb +19 -19
- data/lib/ohai/plugins/solaris2/dmi.rb +63 -63
- data/lib/ohai/plugins/solaris2/filesystem.rb +13 -13
- data/lib/ohai/plugins/solaris2/memory.rb +2 -2
- data/lib/ohai/plugins/solaris2/network.rb +5 -5
- data/lib/ohai/plugins/solaris2/virtualization.rb +18 -18
- data/lib/ohai/plugins/solaris2/zpools.rb +1 -1
- data/lib/ohai/plugins/ssh_host_key.rb +2 -2
- data/lib/ohai/plugins/uptime.rb +4 -5
- data/lib/ohai/plugins/virtualbox.rb +2 -2
- data/lib/ohai/plugins/virtualization.rb +17 -17
- data/lib/ohai/plugins/vmware.rb +2 -2
- data/lib/ohai/plugins/windows/cpu.rb +14 -14
- data/lib/ohai/plugins/windows/drivers.rb +8 -8
- data/lib/ohai/plugins/windows/filesystem.rb +4 -4
- data/lib/ohai/plugins/windows/memory.rb +1 -1
- data/lib/ohai/plugins/windows/network.rb +10 -10
- data/lib/ohai/plugins/windows/platform.rb +1 -2
- data/lib/ohai/plugins/windows/virtualization.rb +17 -17
- data/lib/ohai/provides_map.rb +7 -7
- data/lib/ohai/runner.rb +3 -3
- data/lib/ohai/system.rb +21 -20
- data/lib/ohai/util/file_helper.rb +1 -2
- data/lib/ohai/util/ip_helper.rb +4 -4
- data/lib/ohai/util/win32.rb +5 -5
- data/lib/ohai/util/win32/group_helper.rb +4 -5
- data/lib/ohai/version.rb +1 -1
- data/ohai.gemspec +7 -5
- data/spec/functional/application_spec.rb +23 -23
- data/spec/functional/loader_spec.rb +1 -1
- data/spec/functional/plugins/powershell_spec.rb +13 -13
- data/spec/functional/plugins/root_group_spec.rb +5 -5
- data/spec/ohai_spec.rb +1 -1
- data/spec/spec_helper.rb +9 -9
- data/spec/support/integration_helper.rb +7 -7
- data/spec/support/platform_helpers.rb +1 -1
- data/spec/unit/application_spec.rb +17 -17
- data/spec/unit/config_spec.rb +2 -2
- data/spec/unit/dsl/plugin_spec.rb +28 -28
- data/spec/unit/hints_spec.rb +3 -3
- data/spec/unit/loader_spec.rb +9 -9
- data/spec/unit/mixin/command_spec.rb +5 -5
- data/spec/unit/mixin/ec2_metadata_spec.rb +6 -6
- data/spec/unit/mixin/softlayer_metadata_spec.rb +19 -23
- data/spec/unit/plugin_config_spec.rb +5 -5
- data/spec/unit/plugins/abort_spec.rb +3 -3
- data/spec/unit/plugins/aix/cpu_spec.rb +1 -1
- data/spec/unit/plugins/aix/filesystem_spec.rb +25 -25
- data/spec/unit/plugins/aix/hostname_spec.rb +1 -2
- data/spec/unit/plugins/aix/kernel_spec.rb +3 -3
- data/spec/unit/plugins/aix/memory_spec.rb +8 -8
- data/spec/unit/plugins/aix/network_spec.rb +38 -38
- data/spec/unit/plugins/aix/os_spec.rb +1 -2
- data/spec/unit/plugins/aix/platform_spec.rb +1 -1
- data/spec/unit/plugins/aix/uptime_spec.rb +1 -1
- data/spec/unit/plugins/aix/virtualization_spec.rb +11 -11
- data/spec/unit/plugins/azure_spec.rb +118 -20
- data/spec/unit/plugins/bsd/filesystem_spec.rb +1 -1
- data/spec/unit/plugins/bsd/virtualization_spec.rb +4 -4
- data/spec/unit/plugins/c_spec.rb +12 -12
- data/spec/unit/plugins/chef_spec.rb +2 -2
- data/spec/unit/plugins/cloud_spec.rb +37 -37
- data/spec/unit/plugins/cloud_v2_spec.rb +64 -65
- data/spec/unit/plugins/darwin/cpu_spec.rb +1 -2
- data/spec/unit/plugins/darwin/filesystem2_spec.rb +7 -7
- data/spec/unit/plugins/darwin/filesystem_spec.rb +5 -5
- data/spec/unit/plugins/darwin/hostname_spec.rb +1 -4
- data/spec/unit/plugins/darwin/kernel_spec.rb +6 -10
- data/spec/unit/plugins/darwin/memory_spec.rb +5 -5
- data/spec/unit/plugins/darwin/network_spec.rb +352 -353
- data/spec/unit/plugins/darwin/platform_spec.rb +1 -2
- data/spec/unit/plugins/darwin/system_profiler_spec.rb +3 -3
- data/spec/unit/plugins/darwin/virtualization_spec.rb +6 -6
- data/spec/unit/plugins/digital_ocean_spec.rb +38 -37
- data/spec/unit/plugins/dmi_spec.rb +3 -3
- data/spec/unit/plugins/ec2_spec.rb +97 -88
- data/spec/unit/plugins/elixir_spec.rb +1 -2
- data/spec/unit/plugins/erlang_spec.rb +2 -2
- data/spec/unit/plugins/eucalyptus_spec.rb +19 -19
- data/spec/unit/plugins/fail_spec.rb +2 -2
- data/spec/unit/plugins/freebsd/cpu_spec.rb +14 -14
- data/spec/unit/plugins/freebsd/hostname_spec.rb +1 -2
- data/spec/unit/plugins/freebsd/kernel_spec.rb +2 -3
- data/spec/unit/plugins/freebsd/os_spec.rb +4 -5
- data/spec/unit/plugins/freebsd/platform_spec.rb +1 -2
- data/spec/unit/plugins/gce_spec.rb +9 -9
- data/spec/unit/plugins/go_spec.rb +1 -1
- data/spec/unit/plugins/groovy_spec.rb +1 -2
- data/spec/unit/plugins/hostname_spec.rb +1 -2
- data/spec/unit/plugins/init_package_spec.rb +1 -1
- data/spec/unit/plugins/ip_scopes_spec.rb +38 -38
- data/spec/unit/plugins/java_spec.rb +52 -1
- data/spec/unit/plugins/joyent_spec.rb +9 -11
- data/spec/unit/plugins/kernel_spec.rb +11 -12
- data/spec/unit/plugins/linode_spec.rb +29 -29
- data/spec/unit/plugins/linux/block_device_spec.rb +21 -21
- data/spec/unit/plugins/linux/cpu_spec.rb +3 -3
- data/spec/unit/plugins/linux/filesystem2_spec.rb +7 -7
- data/spec/unit/plugins/linux/filesystem_spec.rb +85 -86
- data/spec/unit/plugins/linux/hostname_spec.rb +1 -3
- data/spec/unit/plugins/linux/kernel_spec.rb +1 -1
- data/spec/unit/plugins/linux/lsb_spec.rb +1 -2
- data/spec/unit/plugins/linux/mdadm_spec.rb +4 -4
- data/spec/unit/plugins/linux/memory_spec.rb +29 -33
- data/spec/unit/plugins/linux/network_spec.rb +463 -245
- data/spec/unit/plugins/linux/platform_spec.rb +64 -65
- data/spec/unit/plugins/linux/uptime_spec.rb +1 -2
- data/spec/unit/plugins/linux/virtualization_spec.rb +42 -42
- data/spec/unit/plugins/lua_spec.rb +1 -2
- data/spec/unit/plugins/mono_spec.rb +1 -2
- data/spec/unit/plugins/netbsd/hostname_spec.rb +1 -2
- data/spec/unit/plugins/netbsd/kernel_spec.rb +1 -2
- data/spec/unit/plugins/netbsd/platform_spec.rb +1 -1
- data/spec/unit/plugins/network_spec.rb +118 -118
- data/spec/unit/plugins/nodejs_spec.rb +1 -1
- data/spec/unit/plugins/ohai_spec.rb +1 -1
- data/spec/unit/plugins/ohai_time_spec.rb +1 -2
- data/spec/unit/plugins/openbsd/hostname_spec.rb +1 -2
- data/spec/unit/plugins/openbsd/kernel_spec.rb +1 -2
- data/spec/unit/plugins/openbsd/platform_spec.rb +1 -2
- data/spec/unit/plugins/openstack_spec.rb +35 -37
- data/spec/unit/plugins/os_spec.rb +7 -8
- data/spec/unit/plugins/packages_spec.rb +118 -118
- data/spec/unit/plugins/passwd_spec.rb +18 -18
- data/spec/unit/plugins/perl_spec.rb +1 -1
- data/spec/unit/plugins/php_spec.rb +4 -4
- data/spec/unit/plugins/platform_spec.rb +8 -9
- data/spec/unit/plugins/powershell_spec.rb +3 -3
- data/spec/unit/plugins/python_spec.rb +1 -1
- data/spec/unit/plugins/rackspace_spec.rb +66 -68
- data/spec/unit/plugins/root_group_spec.rb +26 -26
- data/spec/unit/plugins/ruby_spec.rb +14 -15
- data/spec/unit/plugins/rust_spec.rb +2 -2
- data/spec/unit/plugins/sigar/network_route_spec.rb +36 -36
- data/spec/unit/plugins/softlayer_spec.rb +10 -10
- data/spec/unit/plugins/solaris2/cpu_spec.rb +20 -21
- data/spec/unit/plugins/solaris2/dmi_spec.rb +5 -6
- data/spec/unit/plugins/solaris2/filesystem.rb +5 -5
- data/spec/unit/plugins/solaris2/hostname_spec.rb +1 -1
- data/spec/unit/plugins/solaris2/kernel_spec.rb +3 -3
- data/spec/unit/plugins/solaris2/memory_spec.rb +5 -5
- data/spec/unit/plugins/solaris2/network_spec.rb +7 -8
- data/spec/unit/plugins/solaris2/platform_spec.rb +1 -1
- data/spec/unit/plugins/solaris2/virtualization_spec.rb +3 -5
- data/spec/unit/plugins/solaris2/zpools_spec.rb +6 -6
- data/spec/unit/plugins/ssh_host_keys_spec.rb +1 -1
- data/spec/unit/plugins/virtualbox_spec.rb +19 -19
- data/spec/unit/plugins/vmware_spec.rb +28 -28
- data/spec/unit/plugins/windows/cpu_spec.rb +46 -48
- data/spec/unit/plugins/windows/memory_spec.rb +5 -5
- data/spec/unit/plugins/windows/virtualization_spec.rb +163 -163
- data/spec/unit/provides_map_spec.rb +10 -10
- data/spec/unit/runner_spec.rb +10 -10
- data/spec/unit/system_spec.rb +19 -19
- data/spec/unit/util/file_helper_spec.rb +5 -6
- data/spec/unit/util/ip_helper_spec.rb +39 -39
- metadata +31 -4
@@ -16,7 +16,7 @@
|
|
16
16
|
# limitations under the License.
|
17
17
|
#
|
18
18
|
|
19
|
-
require File.expand_path(File.dirname(__FILE__) +
|
19
|
+
require File.expand_path(File.dirname(__FILE__) + "/../../../spec_helper.rb")
|
20
20
|
|
21
21
|
describe Ohai::System, "Solaris2.X hostname plugin" do
|
22
22
|
before(:each) do
|
@@ -16,13 +16,13 @@
|
|
16
16
|
# limitations under the License.
|
17
17
|
#
|
18
18
|
|
19
|
-
require File.expand_path(File.dirname(__FILE__) +
|
19
|
+
require File.expand_path(File.dirname(__FILE__) + "/../../../spec_helper.rb")
|
20
20
|
|
21
21
|
describe Ohai::System, "Solaris2.X kernel plugin" do
|
22
22
|
# NOTE: Solaris will report the same module loaded multiple times
|
23
23
|
# with the same ID, Loadaddr, etc. and only the info column different
|
24
24
|
# ignoring it, and removing the data from this fixture.
|
25
|
-
MODINFO
|
25
|
+
MODINFO = <<-TOOMUCH
|
26
26
|
Id Loadaddr Size Info Rev Module Name
|
27
27
|
6 1180000 4623 1 1 specfs (filesystem for specfs)
|
28
28
|
8 1185df0 38c4 1 1 TS (time sharing sched class)
|
@@ -151,7 +151,7 @@ describe Ohai::System, "Solaris2.X kernel plugin" do
|
|
151
151
|
# Teh daterz
|
152
152
|
# Id Loadaddr Size Info Rev Module Name
|
153
153
|
# 6 1180000 4623 1 1 specfs (filesystem for specfs)
|
154
|
-
teh_daterz = { "id" => 6, "loadaddr" => "1180000", "size" =>
|
154
|
+
teh_daterz = { "id" => 6, "loadaddr" => "1180000", "size" => 17955, "description" => "filesystem for specfs" }
|
155
155
|
expect(@plugin[:kernel][:modules].keys).to include("specfs")
|
156
156
|
expect(@plugin[:kernel][:modules].keys).not_to include("Module")
|
157
157
|
expect(@plugin[:kernel][:modules]["specfs"]).to eq(teh_daterz)
|
@@ -14,7 +14,7 @@
|
|
14
14
|
# limitations under the License.
|
15
15
|
#
|
16
16
|
|
17
|
-
require File.expand_path(File.dirname(__FILE__) +
|
17
|
+
require File.expand_path(File.dirname(__FILE__) + "/../../../spec_helper.rb")
|
18
18
|
|
19
19
|
describe Ohai::System, "Solaris2.X memory plugin" do
|
20
20
|
before(:each) do
|
@@ -22,22 +22,22 @@ describe Ohai::System, "Solaris2.X memory plugin" do
|
|
22
22
|
allow(@plugin).to receive(:collect_os).and_return("solaris2")
|
23
23
|
allow(@plugin).to receive(:shell_out).with("prtconf | grep Memory").and_return(mock_shell_out(0, "Memory size: 8194 Megabytes\n", ""))
|
24
24
|
@swap_s = "total: 112230656k bytes allocated + 357865576k reserved = 470096232k used, 47057688k available\n"
|
25
|
-
allow(@plugin).to receive(:shell_out).with("swap -s").and_return(mock_shell_out(0
|
25
|
+
allow(@plugin).to receive(:shell_out).with("swap -s").and_return(mock_shell_out(0, @swap_s, ""))
|
26
26
|
end
|
27
27
|
|
28
28
|
it "should get the total memory" do
|
29
29
|
@plugin.run
|
30
30
|
expect(@plugin[:memory][:total]).to eql("#{8194 * 1024}kB")
|
31
31
|
end
|
32
|
-
|
32
|
+
|
33
33
|
it "should get total swap" do
|
34
34
|
@plugin.run
|
35
35
|
expect(@plugin[:memory][:swap][:total]).to eql("#{(470096232 + 47057688)}kB" )
|
36
36
|
end
|
37
|
-
|
37
|
+
|
38
38
|
it "should get free swap" do
|
39
39
|
@plugin.run
|
40
40
|
expect(@plugin[:memory][:swap][:free]).to eql("47057688kB")
|
41
41
|
end
|
42
|
-
|
42
|
+
|
43
43
|
end
|
@@ -16,7 +16,7 @@
|
|
16
16
|
# limitations under the License.
|
17
17
|
#
|
18
18
|
|
19
|
-
require File.expand_path(File.dirname(__FILE__) +
|
19
|
+
require File.expand_path(File.dirname(__FILE__) + "/../../../spec_helper.rb")
|
20
20
|
|
21
21
|
describe Ohai::System, "Solaris2.X network plugin" do
|
22
22
|
|
@@ -129,23 +129,23 @@ ROUTE_GET
|
|
129
129
|
end
|
130
130
|
|
131
131
|
it "completes the run" do
|
132
|
-
expect(@plugin[
|
132
|
+
expect(@plugin["network"]).not_to be_nil
|
133
133
|
end
|
134
134
|
|
135
135
|
it "detects the interfaces" do
|
136
|
-
expect(@plugin[
|
136
|
+
expect(@plugin["network"]["interfaces"].keys.sort).to eq(["e1000g0:3", "e1000g2:1", "eri0", "ip.tun0", "ip.tun0:1", "lo0", "lo0:3", "net0", "qfe1"])
|
137
137
|
end
|
138
138
|
|
139
139
|
it "detects the ip addresses of the interfaces" do
|
140
|
-
expect(@plugin[
|
140
|
+
expect(@plugin["network"]["interfaces"]["e1000g0:3"]["addresses"].keys).to include("72.2.115.28")
|
141
141
|
end
|
142
142
|
|
143
143
|
it "detects the encapsulation type of the interfaces" do
|
144
|
-
expect(@plugin[
|
144
|
+
expect(@plugin["network"]["interfaces"]["e1000g0:3"]["encapsulation"]).to eq("Ethernet")
|
145
145
|
end
|
146
146
|
|
147
147
|
it "detects the L3PROTECT network flag" do
|
148
|
-
expect(@plugin[
|
148
|
+
expect(@plugin["network"]["interfaces"]["net0"]["flags"]).to include("L3PROTECT")
|
149
149
|
end
|
150
150
|
end
|
151
151
|
|
@@ -159,8 +159,7 @@ ROUTE_GET
|
|
159
159
|
end
|
160
160
|
|
161
161
|
it "finds the default interface by asking which iface has the default route" do
|
162
|
-
expect(@plugin[:network][:default_interface]).to eq(
|
162
|
+
expect(@plugin[:network][:default_interface]).to eq("e1000g0")
|
163
163
|
end
|
164
164
|
end
|
165
165
|
end
|
166
|
-
|
@@ -16,7 +16,7 @@
|
|
16
16
|
# limitations under the License.
|
17
17
|
#
|
18
18
|
|
19
|
-
require File.expand_path(File.dirname(__FILE__) +
|
19
|
+
require File.expand_path(File.dirname(__FILE__) + "/../../../spec_helper.rb")
|
20
20
|
|
21
21
|
describe Ohai::System, "Solaris plugin platform" do
|
22
22
|
before(:each) do
|
@@ -16,7 +16,7 @@
|
|
16
16
|
# limitations under the License.
|
17
17
|
#
|
18
18
|
|
19
|
-
require File.expand_path(File.dirname(__FILE__) +
|
19
|
+
require File.expand_path(File.dirname(__FILE__) + "/../../../spec_helper.rb")
|
20
20
|
|
21
21
|
describe Ohai::System, "Solaris virtualization platform" do
|
22
22
|
before(:each) do
|
@@ -72,7 +72,7 @@ PSRINFO_PV
|
|
72
72
|
end
|
73
73
|
|
74
74
|
it "should set virtualpc guest if smbios detects Microsoft Virtual Machine" do
|
75
|
-
ms_vpc_smbios
|
75
|
+
ms_vpc_smbios = <<-MSVPC
|
76
76
|
ID SIZE TYPE
|
77
77
|
1 72 SMB_TYPE_SYSTEM (system information)
|
78
78
|
|
@@ -91,7 +91,7 @@ MSVPC
|
|
91
91
|
end
|
92
92
|
|
93
93
|
it "should set vmware guest if smbios detects VMware Virtual Platform" do
|
94
|
-
vmware_smbios
|
94
|
+
vmware_smbios = <<-VMWARE
|
95
95
|
ID SIZE TYPE
|
96
96
|
1 72 SMB_TYPE_SYSTEM (system information)
|
97
97
|
|
@@ -121,5 +121,3 @@ VMWARE
|
|
121
121
|
expect(@plugin[:virtualization]).to eq({})
|
122
122
|
end
|
123
123
|
end
|
124
|
-
|
125
|
-
|
@@ -13,7 +13,7 @@
|
|
13
13
|
# limitations under the License.
|
14
14
|
#
|
15
15
|
|
16
|
-
require File.expand_path(File.dirname(__FILE__) +
|
16
|
+
require File.expand_path(File.dirname(__FILE__) + "/../../../spec_helper.rb")
|
17
17
|
|
18
18
|
describe Ohai::System, "Solaris 2.x zpool plugin" do
|
19
19
|
before(:each) do
|
@@ -62,9 +62,9 @@ EOST
|
|
62
62
|
rpool 109G 66.2G 42.8G 60% 1.00x ONLINE 34
|
63
63
|
tank 130T 4.91M 130T 0% 1.00x ONLINE 34
|
64
64
|
EOZO
|
65
|
-
allow(@plugin).to receive(:shell_out).with("zpool list -H -o name,size,alloc,free,cap,dedup,health,version").and_return(mock_shell_out(0
|
66
|
-
allow(@plugin).to receive(:shell_out).with("su adm -c \"zpool status rpool\"").and_return(mock_shell_out(0
|
67
|
-
allow(@plugin).to receive(:shell_out).with("su adm -c \"zpool status tank\"").and_return(mock_shell_out(0
|
65
|
+
allow(@plugin).to receive(:shell_out).with("zpool list -H -o name,size,alloc,free,cap,dedup,health,version").and_return(mock_shell_out(0, @zpool_out, ""))
|
66
|
+
allow(@plugin).to receive(:shell_out).with("su adm -c \"zpool status rpool\"").and_return(mock_shell_out(0, @zpool_status_rpool, ""))
|
67
|
+
allow(@plugin).to receive(:shell_out).with("su adm -c \"zpool status tank\"").and_return(mock_shell_out(0, @zpool_status_tank, ""))
|
68
68
|
end
|
69
69
|
|
70
70
|
describe "On Solaris2 Common" do
|
@@ -123,7 +123,7 @@ EOZO
|
|
123
123
|
rpool 109G 66.2G 42.8G 60% 1.00x ONLINE -
|
124
124
|
tank 130T 4.91M 130T 0% 1.00x ONLINE -
|
125
125
|
EOZO
|
126
|
-
allow(@plugin).to receive(:shell_out).with("zpool list -H -o name,size,alloc,free,cap,dedup,health,version").and_return(mock_shell_out(0
|
126
|
+
allow(@plugin).to receive(:shell_out).with("zpool list -H -o name,size,alloc,free,cap,dedup,health,version").and_return(mock_shell_out(0, @zpool_out, ""))
|
127
127
|
end
|
128
128
|
|
129
129
|
it "Won't have a version number" do
|
@@ -140,7 +140,7 @@ EOZO
|
|
140
140
|
rpool 109G 66.2G 42.8G 60% 1.00x ONLINE 34
|
141
141
|
tank 130T 4.91M 130T 0% 1.00x ONLINE 34
|
142
142
|
EOZO
|
143
|
-
allow(@plugin).to receive(:shell_out).with("zpool list -H -o name,size,alloc,free,cap,dedup,health,version").and_return(mock_shell_out(0
|
143
|
+
allow(@plugin).to receive(:shell_out).with("zpool list -H -o name,size,alloc,free,cap,dedup,health,version").and_return(mock_shell_out(0, @zpool_out, ""))
|
144
144
|
end
|
145
145
|
|
146
146
|
it "Should have a version number" do
|
@@ -16,7 +16,7 @@
|
|
16
16
|
# limitations under the License.
|
17
17
|
#
|
18
18
|
|
19
|
-
require File.expand_path(File.join(File.dirname(__FILE__),
|
19
|
+
require File.expand_path(File.join(File.dirname(__FILE__), "..", "..", "/spec_helper.rb"))
|
20
20
|
|
21
21
|
describe Ohai::System, "ssh_host_key plugin" do
|
22
22
|
|
@@ -15,7 +15,7 @@
|
|
15
15
|
# limitations under the License.
|
16
16
|
#
|
17
17
|
|
18
|
-
require File.expand_path(File.join(File.dirname(__FILE__),
|
18
|
+
require File.expand_path(File.join(File.dirname(__FILE__), "..", "..", "/spec_helper.rb"))
|
19
19
|
|
20
20
|
vbox_output = <<EOF
|
21
21
|
Oracle VM VirtualBox Guest Additions Command Line Management Interface Version 5.0.2
|
@@ -47,42 +47,42 @@ Name: /VirtualBox/GuestInfo/OS/Release, value: 3.19.0-31-generic, timestamp: 144
|
|
47
47
|
Name: /VirtualBox/GuestInfo/OS/NoLoggedInUsers, value: false, timestamp: 1448390452251532000, flags: TRANSIENT, TRANSRESET
|
48
48
|
EOF
|
49
49
|
|
50
|
-
describe Ohai::System,
|
51
|
-
context
|
52
|
-
it
|
53
|
-
plugin = get_plugin(
|
54
|
-
allow(plugin).to receive(:shell_out).with(
|
50
|
+
describe Ohai::System, "plugin virtualbox" do
|
51
|
+
context "when VBoxControl shellout fails" do
|
52
|
+
it "should not set the virtualbox attribute" do
|
53
|
+
plugin = get_plugin("virtualbox")
|
54
|
+
allow(plugin).to receive(:shell_out).with("VBoxControl guestproperty enumerate").and_return(mock_shell_out(1, "", ""))
|
55
55
|
plugin.run
|
56
56
|
expect(plugin).not_to have_key(:virtualbox)
|
57
57
|
end
|
58
58
|
end
|
59
59
|
|
60
|
-
context
|
61
|
-
let(:plugin) { get_plugin(
|
60
|
+
context "when VBoxControl shellout succeeds" do
|
61
|
+
let(:plugin) { get_plugin("virtualbox") }
|
62
62
|
|
63
63
|
before(:each) do
|
64
|
-
allow(plugin).to receive(:shell_out).with(
|
64
|
+
allow(plugin).to receive(:shell_out).with("VBoxControl guestproperty enumerate").and_return(mock_shell_out(0, vbox_output, ""))
|
65
65
|
plugin.run
|
66
66
|
end
|
67
67
|
|
68
|
-
it
|
69
|
-
expect(plugin[:virtualbox][:host][:version]).to eql(
|
68
|
+
it "should set the host version" do
|
69
|
+
expect(plugin[:virtualbox][:host][:version]).to eql("5.0.10")
|
70
70
|
end
|
71
71
|
|
72
|
-
it
|
73
|
-
expect(plugin[:virtualbox][:host][:revision]).to eql(
|
72
|
+
it "should set the host revision" do
|
73
|
+
expect(plugin[:virtualbox][:host][:revision]).to eql("104061")
|
74
74
|
end
|
75
75
|
|
76
|
-
it
|
77
|
-
expect(plugin[:virtualbox][:host][:language]).to eql(
|
76
|
+
it "should set the host language" do
|
77
|
+
expect(plugin[:virtualbox][:host][:language]).to eql("en_US")
|
78
78
|
end
|
79
79
|
|
80
|
-
it
|
81
|
-
expect(plugin[:virtualbox][:guest][:guest_additions_version]).to eql(
|
80
|
+
it "should set the guest additions version" do
|
81
|
+
expect(plugin[:virtualbox][:guest][:guest_additions_version]).to eql("5.0.2")
|
82
82
|
end
|
83
83
|
|
84
|
-
it
|
85
|
-
expect(plugin[:virtualbox][:guest][:guest_additions_revision]).to eql(
|
84
|
+
it "should set the guest additions revision" do
|
85
|
+
expect(plugin[:virtualbox][:guest][:guest_additions_revision]).to eql("102096")
|
86
86
|
end
|
87
87
|
end
|
88
88
|
end
|
@@ -14,61 +14,61 @@
|
|
14
14
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
15
15
|
# See the License for the specific language governing permissions and
|
16
16
|
# limitations under the License.
|
17
|
-
require
|
17
|
+
require "spec_helper"
|
18
18
|
|
19
|
-
describe Ohai::System,
|
20
|
-
let(:plugin) { get_plugin(
|
21
|
-
let(:path) {
|
19
|
+
describe Ohai::System, "plugin vmware" do
|
20
|
+
let(:plugin) { get_plugin("vmware") }
|
21
|
+
let(:path) { "/usr/bin/vmware-toolbox-cmd" }
|
22
22
|
|
23
23
|
before(:each) do
|
24
24
|
allow(plugin).to receive(:collect_os).and_return(:linux)
|
25
25
|
end
|
26
26
|
|
27
|
-
context
|
27
|
+
context "on vmware guest with toolbox installed" do
|
28
28
|
before(:each) do
|
29
|
-
allow(File).to receive(:exist?).with(
|
30
|
-
allow(plugin).to receive(:shell_out).with("#{path} stat speed").and_return(mock_shell_out(0,
|
31
|
-
allow(plugin).to receive(:shell_out).with("#{path} stat hosttime").and_return(mock_shell_out(0,
|
32
|
-
allow(plugin).to receive(:shell_out).with("#{path} stat sessionid").and_return(mock_shell_out(0,
|
33
|
-
allow(plugin).to receive(:shell_out).with("#{path} stat balloon").and_return(mock_shell_out(0,
|
34
|
-
allow(plugin).to receive(:shell_out).with("#{path} stat swap").and_return(mock_shell_out(0,
|
35
|
-
allow(plugin).to receive(:shell_out).with("#{path} stat memlimit").and_return(mock_shell_out(0,
|
36
|
-
allow(plugin).to receive(:shell_out).with("#{path} stat memres").and_return(mock_shell_out(0,
|
37
|
-
allow(plugin).to receive(:shell_out).with("#{path} stat cpures").and_return(mock_shell_out(0,
|
38
|
-
allow(plugin).to receive(:shell_out).with("#{path} stat cpulimit").and_return(mock_shell_out(0,
|
39
|
-
allow(plugin).to receive(:shell_out).with("#{path} upgrade status").and_return(mock_shell_out(0,
|
40
|
-
allow(plugin).to receive(:shell_out).with("#{path} timesync status").and_return(mock_shell_out(0,
|
29
|
+
allow(File).to receive(:exist?).with("/usr/bin/vmware-toolbox-cmd").and_return(true)
|
30
|
+
allow(plugin).to receive(:shell_out).with("#{path} stat speed").and_return(mock_shell_out(0, "2000 MHz", nil))
|
31
|
+
allow(plugin).to receive(:shell_out).with("#{path} stat hosttime").and_return(mock_shell_out(0, "04 Jun 2015 19:21:16", nil))
|
32
|
+
allow(plugin).to receive(:shell_out).with("#{path} stat sessionid").and_return(mock_shell_out(0, "0x0000000000000000", nil))
|
33
|
+
allow(plugin).to receive(:shell_out).with("#{path} stat balloon").and_return(mock_shell_out(0, "0 MB", nil))
|
34
|
+
allow(plugin).to receive(:shell_out).with("#{path} stat swap").and_return(mock_shell_out(0, "0 MB", nil))
|
35
|
+
allow(plugin).to receive(:shell_out).with("#{path} stat memlimit").and_return(mock_shell_out(0, "4000000000 MB", nil))
|
36
|
+
allow(plugin).to receive(:shell_out).with("#{path} stat memres").and_return(mock_shell_out(0, "0 MB", nil))
|
37
|
+
allow(plugin).to receive(:shell_out).with("#{path} stat cpures").and_return(mock_shell_out(0, "0 MHz", nil))
|
38
|
+
allow(plugin).to receive(:shell_out).with("#{path} stat cpulimit").and_return(mock_shell_out(0, "4000000000 MB", nil))
|
39
|
+
allow(plugin).to receive(:shell_out).with("#{path} upgrade status").and_return(mock_shell_out(0, "VMware Tools are up-to-date.", nil))
|
40
|
+
allow(plugin).to receive(:shell_out).with("#{path} timesync status").and_return(mock_shell_out(0, "Disabled", nil))
|
41
41
|
plugin[:virtualization] = Mash.new
|
42
42
|
plugin[:virtualization][:systems] = Mash.new
|
43
43
|
plugin[:virtualization][:systems][:vmware] = Mash.new
|
44
44
|
plugin.run
|
45
45
|
end
|
46
46
|
|
47
|
-
it
|
48
|
-
expect(plugin[:vmware][:speed]).to eq(
|
47
|
+
it "gets the speed" do
|
48
|
+
expect(plugin[:vmware][:speed]).to eq("2000 MHz")
|
49
49
|
end
|
50
50
|
|
51
|
-
it
|
52
|
-
expect(plugin[:vmware][:hosttime]).to eq(
|
51
|
+
it "gets the hosttime" do
|
52
|
+
expect(plugin[:vmware][:hosttime]).to eq("04 Jun 2015 19:21:16")
|
53
53
|
end
|
54
54
|
|
55
|
-
it
|
56
|
-
expect(plugin[:vmware][:upgrade]).to eq(
|
55
|
+
it "gets tools update status" do
|
56
|
+
expect(plugin[:vmware][:upgrade]).to eq("VMware Tools are up-to-date.")
|
57
57
|
end
|
58
58
|
end
|
59
59
|
|
60
|
-
context
|
61
|
-
it
|
60
|
+
context "on vmware guest without toolbox" do
|
61
|
+
it "should not create a vmware attribute" do
|
62
62
|
plugin[:virtualization] = Mash.new
|
63
63
|
plugin[:virtualization][:systems] = Mash.new
|
64
64
|
plugin[:virtualization][:systems][:vmware] = Mash.new
|
65
|
-
allow(File).to receive(:exist?).with(
|
65
|
+
allow(File).to receive(:exist?).with("/usr/bin/vmware-toolbox-cmd").and_return(false)
|
66
66
|
expect(plugin).not_to have_key(:vmware)
|
67
67
|
end
|
68
68
|
end
|
69
69
|
|
70
|
-
context
|
71
|
-
it
|
70
|
+
context "on vbox guest" do
|
71
|
+
it "should not create a vmware attribute" do
|
72
72
|
plugin[:virtualization] = Mash.new
|
73
73
|
plugin[:virtualization][:systems] = Mash.new
|
74
74
|
plugin[:virtualization][:systems][:vbox] = Mash.new
|
@@ -16,99 +16,97 @@
|
|
16
16
|
# limitations under the License.
|
17
17
|
#
|
18
18
|
|
19
|
-
require File.expand_path(File.dirname(__FILE__) +
|
19
|
+
require File.expand_path(File.dirname(__FILE__) + "/../../../spec_helper.rb")
|
20
20
|
|
21
|
-
shared_examples
|
21
|
+
shared_examples "a cpu" do |cpu_no|
|
22
22
|
describe "cpu #{cpu_no}" do
|
23
23
|
it "should set physical_id to CPU#{cpu_no}" do
|
24
24
|
expect(@plugin[:cpu]["#{cpu_no}"][:physical_id]).to eq("CPU#{cpu_no}")
|
25
25
|
end
|
26
26
|
|
27
|
-
it
|
28
|
-
expect(@plugin[:cpu]["#{cpu_no}"][:mhz]).to eq(
|
27
|
+
it "should set mhz to 2793" do
|
28
|
+
expect(@plugin[:cpu]["#{cpu_no}"][:mhz]).to eq("2793")
|
29
29
|
end
|
30
30
|
|
31
|
-
it
|
32
|
-
expect(@plugin[:cpu]["#{cpu_no}"][:vendor_id]).to eq(
|
31
|
+
it "should set vendor_id to GenuineIntel" do
|
32
|
+
expect(@plugin[:cpu]["#{cpu_no}"][:vendor_id]).to eq("GenuineIntel")
|
33
33
|
end
|
34
34
|
|
35
|
-
it
|
35
|
+
it "should set model_name to Intel64 Family 6 Model 70 Stepping 1" do
|
36
36
|
expect(@plugin[:cpu]["#{cpu_no}"][:model_name])
|
37
|
-
.to eq(
|
37
|
+
.to eq("Intel64 Family 6 Model 70 Stepping 1")
|
38
38
|
end
|
39
39
|
|
40
|
-
it
|
41
|
-
expect(@plugin[:cpu]["#{cpu_no}"][:model]).to eq(
|
40
|
+
it "should set model to 17921" do
|
41
|
+
expect(@plugin[:cpu]["#{cpu_no}"][:model]).to eq("17921")
|
42
42
|
end
|
43
43
|
|
44
|
-
it
|
45
|
-
expect(@plugin[:cpu]["#{cpu_no}"][:family]).to eq(
|
44
|
+
it "should set family to 2" do
|
45
|
+
expect(@plugin[:cpu]["#{cpu_no}"][:family]).to eq("2")
|
46
46
|
end
|
47
47
|
|
48
|
-
it
|
48
|
+
it "should set stepping to 9" do
|
49
49
|
expect(@plugin[:cpu]["#{cpu_no}"][:stepping]).to eq(9)
|
50
50
|
end
|
51
51
|
|
52
|
-
it
|
53
|
-
expect(@plugin[:cpu]["#{cpu_no}"][:cache_size]).to eq(
|
52
|
+
it "should set cache_size to 64 KB" do
|
53
|
+
expect(@plugin[:cpu]["#{cpu_no}"][:cache_size]).to eq("64 KB")
|
54
54
|
end
|
55
55
|
end
|
56
56
|
end
|
57
57
|
|
58
|
-
describe Ohai::System,
|
58
|
+
describe Ohai::System, "Windows cpu plugin" do
|
59
59
|
before(:each) do
|
60
|
-
@plugin = get_plugin(
|
60
|
+
@plugin = get_plugin("windows/cpu")
|
61
61
|
allow(@plugin).to receive(:collect_os).and_return(:windows)
|
62
62
|
|
63
63
|
@double_wmi = double(WmiLite::Wmi)
|
64
64
|
@double_wmi_instance = instance_double(WmiLite::Wmi)
|
65
65
|
|
66
|
-
@processors = [{
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
'stepping' => 9,
|
88
|
-
'l2cachesize' => 64 }]
|
66
|
+
@processors = [{ "description" => "Intel64 Family 6 Model 70 Stepping 1",
|
67
|
+
"deviceid" => "CPU0",
|
68
|
+
"family" => 2,
|
69
|
+
"manufacturer" => "GenuineIntel",
|
70
|
+
"maxclockspeed" => 2793,
|
71
|
+
"numberofcores" => 1,
|
72
|
+
"numberoflogicalprocessors" => 2,
|
73
|
+
"revision" => 17_921,
|
74
|
+
"stepping" => 9,
|
75
|
+
"l2cachesize" => 64 },
|
76
|
+
|
77
|
+
{ "description" => "Intel64 Family 6 Model 70 Stepping 1",
|
78
|
+
"deviceid" => "CPU1",
|
79
|
+
"family" => 2,
|
80
|
+
"manufacturer" => "GenuineIntel",
|
81
|
+
"maxclockspeed" => 2793,
|
82
|
+
"numberofcores" => 1,
|
83
|
+
"numberoflogicalprocessors" => 2,
|
84
|
+
"revision" => 17_921,
|
85
|
+
"stepping" => 9,
|
86
|
+
"l2cachesize" => 64 }]
|
89
87
|
|
90
88
|
allow(WmiLite::Wmi).to receive(:new).and_return(@double_wmi_instance)
|
91
89
|
|
92
90
|
allow(@double_wmi_instance).to receive(:instances_of)
|
93
|
-
.with(
|
91
|
+
.with("Win32_Processor")
|
94
92
|
.and_return(@processors)
|
95
93
|
|
96
94
|
@plugin.run
|
97
95
|
end
|
98
96
|
|
99
|
-
it
|
97
|
+
it "should set total cpu to 2" do
|
100
98
|
expect(@plugin[:cpu][:total]).to eq(4)
|
101
99
|
end
|
102
100
|
|
103
|
-
it
|
101
|
+
it "should set real cpu to 2" do
|
104
102
|
expect(@plugin[:cpu][:real]).to eq(2)
|
105
103
|
end
|
106
104
|
|
107
|
-
it
|
108
|
-
expect(@plugin[:cpu]).to have_key(
|
109
|
-
expect(@plugin[:cpu]).to have_key(
|
105
|
+
it "should set 2 distinct cpus numbered 0 and 1" do
|
106
|
+
expect(@plugin[:cpu]).to have_key("0")
|
107
|
+
expect(@plugin[:cpu]).to have_key("1")
|
110
108
|
end
|
111
109
|
|
112
|
-
it_behaves_like
|
113
|
-
it_behaves_like
|
110
|
+
it_behaves_like "a cpu", 0
|
111
|
+
it_behaves_like "a cpu", 1
|
114
112
|
end
|