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
@@ -17,7 +17,7 @@
|
|
17
17
|
# limitations under the License.
|
18
18
|
#
|
19
19
|
|
20
|
-
require File.expand_path(File.dirname(__FILE__) +
|
20
|
+
require File.expand_path(File.dirname(__FILE__) + "/../../spec_helper.rb")
|
21
21
|
|
22
22
|
describe Ohai::System, "plugin java (Java5 Client VM)" do
|
23
23
|
before(:each) do
|
@@ -114,6 +114,51 @@ describe Ohai::System, "plugin java (Java5 Client VM)" do
|
|
114
114
|
end
|
115
115
|
end
|
116
116
|
|
117
|
+
shared_examples_for "when the openjdk 1.8 is installed" do
|
118
|
+
|
119
|
+
before(:each) do
|
120
|
+
@stderr = "openjdk version \"1.8.0_71\"\nOpenJDK Runtime Environment (build 1.8.0_71-b15)\nOpenJDK 64-Bit Server VM (build 25.71-b15, mixed mode)"
|
121
|
+
allow(@plugin).to receive(:shell_out).with("java -mx64m -version").and_return(mock_shell_out(0, "", @stderr))
|
122
|
+
end
|
123
|
+
|
124
|
+
it "should run java -mx64m -version" do
|
125
|
+
expect(@plugin).to receive(:shell_out).with("java -mx64m -version").and_return(mock_shell_out(0, "", @stderr))
|
126
|
+
@plugin.run
|
127
|
+
end
|
128
|
+
|
129
|
+
it "should set java[:version]" do
|
130
|
+
@plugin.run
|
131
|
+
expect(@plugin[:languages][:java][:version]).to eql("1.8.0_71")
|
132
|
+
end
|
133
|
+
|
134
|
+
it "should set java[:runtime][:name] to runtime name" do
|
135
|
+
@plugin.run
|
136
|
+
expect(@plugin[:languages][:java][:runtime][:name]).to eql("OpenJDK Runtime Environment")
|
137
|
+
end
|
138
|
+
|
139
|
+
it "should set java[:runtime][:build] to runtime build" do
|
140
|
+
@plugin.run
|
141
|
+
expect(@plugin[:languages][:java][:runtime][:build]).to eql("1.8.0_71-b15")
|
142
|
+
end
|
143
|
+
|
144
|
+
it "should set java[:hotspot][:name] to hotspot name" do
|
145
|
+
@plugin.run
|
146
|
+
expect(@plugin[:languages][:java][:hotspot][:name]).to eql("OpenJDK 64-Bit Server VM")
|
147
|
+
end
|
148
|
+
|
149
|
+
it "should set java[:hotspot][:build] to hotspot build" do
|
150
|
+
@plugin.run
|
151
|
+
expect(@plugin[:languages][:java][:hotspot][:build]).to eql("25.71-b15, mixed mode")
|
152
|
+
end
|
153
|
+
|
154
|
+
it "should not set the languages[:java] tree up if java command fails" do
|
155
|
+
@stderr = "Some error output here"
|
156
|
+
allow(@plugin).to receive(:shell_out).with("java -mx64m -version").and_return(mock_shell_out(0, "", @stderr))
|
157
|
+
@plugin.run
|
158
|
+
expect(@plugin[:languages]).not_to have_key(:java)
|
159
|
+
end
|
160
|
+
end
|
161
|
+
|
117
162
|
context "when not on Mac OS X" do
|
118
163
|
before do
|
119
164
|
stub_const("RUBY_PLATFORM", "x86_64-linux")
|
@@ -125,6 +170,9 @@ describe Ohai::System, "plugin java (Java5 Client VM)" do
|
|
125
170
|
context "and the server JRE is installed" do
|
126
171
|
include_examples "when the Server JRE is installed"
|
127
172
|
end
|
173
|
+
context "and the openjdk 1.8 is installed" do
|
174
|
+
include_examples "when the openjdk 1.8 is installed"
|
175
|
+
end
|
128
176
|
end
|
129
177
|
|
130
178
|
context "when on Mac OS X with Java installed" do
|
@@ -149,6 +197,9 @@ describe Ohai::System, "plugin java (Java5 Client VM)" do
|
|
149
197
|
context "and the server JRE is installed" do
|
150
198
|
include_examples "when the Server JRE is installed"
|
151
199
|
end
|
200
|
+
context "and the openjdk 1.8 is installed" do
|
201
|
+
include_examples "when the openjdk 1.8 is installed"
|
202
|
+
end
|
152
203
|
end
|
153
204
|
|
154
205
|
context "and the JVM stubs are installed" do
|
@@ -1,9 +1,8 @@
|
|
1
|
-
require
|
2
|
-
|
1
|
+
require "spec_helper"
|
3
2
|
|
4
3
|
describe Ohai::System, "plugin joyent" do
|
5
4
|
before(:each) do
|
6
|
-
@plugin = get_plugin(
|
5
|
+
@plugin = get_plugin("joyent")
|
7
6
|
end
|
8
7
|
|
9
8
|
describe "without joyent" do
|
@@ -35,7 +34,7 @@ describe Ohai::System, "plugin joyent" do
|
|
35
34
|
end
|
36
35
|
|
37
36
|
it "should ditect global zone" do
|
38
|
-
expect(@plugin[:joyent][:sm_uuid]).to eql
|
37
|
+
expect(@plugin[:joyent][:sm_uuid]).to eql "global"
|
39
38
|
end
|
40
39
|
|
41
40
|
it "should NOT create sm_id" do
|
@@ -45,19 +44,19 @@ describe Ohai::System, "plugin joyent" do
|
|
45
44
|
|
46
45
|
describe "under smartmachine" do
|
47
46
|
before(:each) do
|
48
|
-
@plugin[:virtualization][:guest_uuid] =
|
49
|
-
@plugin[:virtualization][:guest_id] =
|
47
|
+
@plugin[:virtualization][:guest_uuid] = "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxx"
|
48
|
+
@plugin[:virtualization][:guest_id] = "30"
|
50
49
|
allow(@plugin).to receive(:collect_product_file).and_return(["Name: Joyent Instance", "Image: base64 13.4.2", "Documentation: http://wiki.joyent.com/jpc2/SmartMachine+Base"])
|
51
|
-
allow(@plugin).to receive(:collect_pkgsrc).and_return(
|
50
|
+
allow(@plugin).to receive(:collect_pkgsrc).and_return("http://pkgsrc.joyent.com/packages/SmartOS/2013Q4/x86_64/All")
|
52
51
|
@plugin.run
|
53
52
|
end
|
54
53
|
|
55
54
|
it "should retrive zone uuid" do
|
56
|
-
expect(@plugin[:joyent][:sm_uuid]).to eql
|
55
|
+
expect(@plugin[:joyent][:sm_uuid]).to eql "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxx"
|
57
56
|
end
|
58
57
|
|
59
58
|
it "should collect sm_id" do
|
60
|
-
expect(@plugin[:joyent][:sm_id]).to eql
|
59
|
+
expect(@plugin[:joyent][:sm_id]).to eql "30"
|
61
60
|
end
|
62
61
|
|
63
62
|
it "should collect images" do
|
@@ -66,9 +65,8 @@ describe Ohai::System, "plugin joyent" do
|
|
66
65
|
end
|
67
66
|
|
68
67
|
it "should collect pkgsrc" do
|
69
|
-
expect(@plugin[:joyent][:sm_pkgsrc]).to eql
|
68
|
+
expect(@plugin[:joyent][:sm_pkgsrc]).to eql "http://pkgsrc.joyent.com/packages/SmartOS/2013Q4/x86_64/All"
|
70
69
|
end
|
71
70
|
end
|
72
71
|
end
|
73
72
|
end
|
74
|
-
|
@@ -16,8 +16,7 @@
|
|
16
16
|
# limitations under the License.
|
17
17
|
#
|
18
18
|
|
19
|
-
|
20
|
-
require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper.rb')
|
19
|
+
require File.expand_path(File.dirname(__FILE__) + "/../../spec_helper.rb")
|
21
20
|
|
22
21
|
describe Ohai::System, "plugin kernel" do
|
23
22
|
before(:each) do
|
@@ -39,7 +38,7 @@ describe Ohai::System, "plugin kernel" do
|
|
39
38
|
|
40
39
|
describe "when running on windows", :windows_only do
|
41
40
|
before do
|
42
|
-
require
|
41
|
+
require "wmi-lite/wmi"
|
43
42
|
|
44
43
|
@ohai_system = Ohai::System.new
|
45
44
|
@plugin = get_plugin("kernel", @ohai_system)
|
@@ -52,30 +51,30 @@ describe Ohai::System, "plugin kernel" do
|
|
52
51
|
os_type = double("WIN32OLE", :name => "OsType")
|
53
52
|
os_properties = [ caption, version, build_number, csd_version, os_type ]
|
54
53
|
|
55
|
-
os =
|
54
|
+
os = double( "WIN32OLE",
|
56
55
|
:properties_ => os_properties)
|
57
56
|
|
58
|
-
allow(os).to receive(:invoke).with(build_number.name).and_return(
|
59
|
-
allow(os).to receive(:invoke).with(csd_version.name).and_return(
|
57
|
+
allow(os).to receive(:invoke).with(build_number.name).and_return("7601")
|
58
|
+
allow(os).to receive(:invoke).with(csd_version.name).and_return("Service Pack 1")
|
60
59
|
allow(os).to receive(:invoke).with(os_type.name).and_return(18)
|
61
|
-
allow(os).to receive(:invoke).with(caption.name).and_return(
|
62
|
-
allow(os).to receive(:invoke).with(version.name).and_return(
|
60
|
+
allow(os).to receive(:invoke).with(caption.name).and_return("Microsoft Windows 7 Ultimate")
|
61
|
+
allow(os).to receive(:invoke).with(version.name).and_return("6.1.7601")
|
63
62
|
|
64
63
|
os_wmi = WmiLite::Wmi::Instance.new(os)
|
65
64
|
|
66
|
-
expect_any_instance_of(WmiLite::Wmi).to receive(:first_of).with(
|
65
|
+
expect_any_instance_of(WmiLite::Wmi).to receive(:first_of).with("Win32_OperatingSystem").and_return(os_wmi)
|
67
66
|
|
68
67
|
# Mock a Win32_ComputerSystem OLE32 WMI object
|
69
|
-
x64_system_type =
|
68
|
+
x64_system_type = "x64-based PC"
|
70
69
|
|
71
70
|
cs = double("WIN32OLE",
|
72
71
|
:properties_ => [ double("WIN32OLE", :name => "SystemType") ])
|
73
72
|
|
74
|
-
allow(cs).to receive(:invoke).with(
|
73
|
+
allow(cs).to receive(:invoke).with("SystemType").and_return(x64_system_type)
|
75
74
|
|
76
75
|
cs_wmi = WmiLite::Wmi::Instance.new(cs)
|
77
76
|
|
78
|
-
expect_any_instance_of(WmiLite::Wmi).to receive(:first_of).with(
|
77
|
+
expect_any_instance_of(WmiLite::Wmi).to receive(:first_of).with("Win32_ComputerSystem").and_return(cs_wmi)
|
79
78
|
|
80
79
|
@plugin.run
|
81
80
|
end
|
@@ -15,38 +15,38 @@
|
|
15
15
|
# limitations under the License.
|
16
16
|
#
|
17
17
|
|
18
|
-
require File.expand_path(File.dirname(__FILE__) +
|
18
|
+
require File.expand_path(File.dirname(__FILE__) + "/../../spec_helper.rb")
|
19
19
|
|
20
20
|
describe Ohai::System, "plugin linode" do
|
21
|
-
let(:hint_path_nix) {
|
21
|
+
let(:hint_path_nix) { "/etc/chef/ohai/hints/linode.json" }
|
22
22
|
let(:hint_path_win) { 'C:\chef\ohai\hints/linode.json' }
|
23
23
|
|
24
24
|
before do
|
25
25
|
@plugin = get_plugin("linode")
|
26
26
|
@plugin[:network] = {
|
27
|
-
"interfaces"=> {
|
28
|
-
"eth0"=> {
|
29
|
-
"addresses"=> {
|
30
|
-
"1.2.3.4"=> {
|
31
|
-
"broadcast"=> "67.23.20.255",
|
32
|
-
"netmask"=> "255.255.255.0",
|
33
|
-
"family"=> "inet"
|
27
|
+
"interfaces" => {
|
28
|
+
"eth0" => {
|
29
|
+
"addresses" => {
|
30
|
+
"1.2.3.4" => {
|
31
|
+
"broadcast" => "67.23.20.255",
|
32
|
+
"netmask" => "255.255.255.0",
|
33
|
+
"family" => "inet",
|
34
34
|
},
|
35
|
-
"fe80::4240:95ff:fe47:6eed"=> {
|
36
|
-
"scope"=> "Link",
|
37
|
-
"prefixlen"=> "64",
|
38
|
-
"family"=> "inet6"
|
35
|
+
"fe80::4240:95ff:fe47:6eed" => {
|
36
|
+
"scope" => "Link",
|
37
|
+
"prefixlen" => "64",
|
38
|
+
"family" => "inet6",
|
39
39
|
},
|
40
40
|
"40:40:95:47:6E:ED" => {
|
41
41
|
"family" => "lladdr"
|
42
|
-
}
|
42
|
+
},
|
43
43
|
}
|
44
44
|
}
|
45
45
|
}
|
46
46
|
}
|
47
47
|
end
|
48
48
|
|
49
|
-
shared_examples_for "!linode"
|
49
|
+
shared_examples_for "!linode" do
|
50
50
|
it "does not create the linode mash" do
|
51
51
|
@plugin.run
|
52
52
|
expect(@plugin[:linode]).to be_nil
|
@@ -92,19 +92,19 @@ describe Ohai::System, "plugin linode" do
|
|
92
92
|
before do
|
93
93
|
@plugin[:network][:interfaces]["eth0:1"] = {
|
94
94
|
"addresses" => {
|
95
|
-
"5.6.7.8"=> {
|
96
|
-
"broadcast"=> "10.176.191.255",
|
97
|
-
"netmask"=> "255.255.224.0",
|
98
|
-
"family"=> "inet"
|
95
|
+
"5.6.7.8" => {
|
96
|
+
"broadcast" => "10.176.191.255",
|
97
|
+
"netmask" => "255.255.224.0",
|
98
|
+
"family" => "inet",
|
99
99
|
},
|
100
100
|
"fe80::4240:f5ff:feab:2836" => {
|
101
|
-
"scope"=> "Link",
|
102
|
-
"prefixlen"=> "64",
|
103
|
-
"family"=> "inet6"
|
101
|
+
"scope" => "Link",
|
102
|
+
"prefixlen" => "64",
|
103
|
+
"family" => "inet6",
|
104
104
|
},
|
105
105
|
"40:40:F5:AB:28:36" => {
|
106
|
-
"family"=> "lladdr"
|
107
|
-
}
|
106
|
+
"family" => "lladdr"
|
107
|
+
},
|
108
108
|
}
|
109
109
|
}
|
110
110
|
end
|
@@ -121,9 +121,9 @@ describe Ohai::System, "plugin linode" do
|
|
121
121
|
describe "with linode cloud file" do
|
122
122
|
before do
|
123
123
|
allow(File).to receive(:exist?).with(hint_path_nix).and_return(true)
|
124
|
-
allow(File).to receive(:read).with(hint_path_nix).and_return(
|
124
|
+
allow(File).to receive(:read).with(hint_path_nix).and_return("")
|
125
125
|
allow(File).to receive(:exist?).with(hint_path_win).and_return(true)
|
126
|
-
allow(File).to receive(:read).with(hint_path_win).and_return(
|
126
|
+
allow(File).to receive(:read).with(hint_path_win).and_return("")
|
127
127
|
end
|
128
128
|
|
129
129
|
it_should_behave_like "linode"
|
@@ -139,7 +139,7 @@ describe Ohai::System, "plugin linode" do
|
|
139
139
|
end
|
140
140
|
|
141
141
|
context "with ec2 cloud file" do
|
142
|
-
let(:ec2_hint_path_nix) {
|
142
|
+
let(:ec2_hint_path_nix) { "/etc/chef/ohai/hints/ec2.json" }
|
143
143
|
let(:ec2_hint_path_win) { 'C:\chef\ohai\hints/ec2.json' }
|
144
144
|
|
145
145
|
before do
|
@@ -147,9 +147,9 @@ describe Ohai::System, "plugin linode" do
|
|
147
147
|
allow(File).to receive(:exist?).with(hint_path_win).and_return(false)
|
148
148
|
|
149
149
|
allow(File).to receive(:exist?).with(ec2_hint_path_nix).and_return(true)
|
150
|
-
allow(File).to receive(:read).with(ec2_hint_path_nix).and_return(
|
150
|
+
allow(File).to receive(:read).with(ec2_hint_path_nix).and_return("")
|
151
151
|
allow(File).to receive(:exist?).with(ec2_hint_path_win).and_return(true)
|
152
|
-
allow(File).to receive(:read).with(ec2_hint_path_win).and_return(
|
152
|
+
allow(File).to receive(:read).with(ec2_hint_path_win).and_return("")
|
153
153
|
end
|
154
154
|
|
155
155
|
it_should_behave_like "!linode"
|
@@ -15,24 +15,24 @@
|
|
15
15
|
# limitations under the License.
|
16
16
|
#
|
17
17
|
|
18
|
-
require File.expand_path(File.dirname(__FILE__) +
|
18
|
+
require File.expand_path(File.dirname(__FILE__) + "/../../../spec_helper.rb")
|
19
19
|
|
20
|
-
describe Ohai::System,
|
20
|
+
describe Ohai::System, "Linux Block Device Plugin" do
|
21
21
|
DISKS = {
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
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",
|
31
35
|
},
|
32
|
-
'dm-0' => {
|
33
|
-
'size' => '7806976',
|
34
|
-
'removable' => '0'
|
35
|
-
}
|
36
36
|
}
|
37
37
|
|
38
38
|
def file_double(value)
|
@@ -42,11 +42,11 @@ describe Ohai::System, 'Linux Block Device Plugin' do
|
|
42
42
|
end
|
43
43
|
|
44
44
|
before(:each) do
|
45
|
-
@plugin = get_plugin(
|
45
|
+
@plugin = get_plugin("linux/block_device")
|
46
46
|
allow(@plugin).to receive(:collect_os).and_return(:linux)
|
47
47
|
|
48
|
-
allow(File).to receive(:exists?).with(
|
49
|
-
allow(Dir).to receive(:[]).with(
|
48
|
+
allow(File).to receive(:exists?).with("/sys/block").and_return(true)
|
49
|
+
allow(Dir).to receive(:[]).with("/sys/block/*") do
|
50
50
|
DISKS.collect { |disk, _files| "/sys/block/#{disk}" }
|
51
51
|
end
|
52
52
|
|
@@ -56,17 +56,17 @@ describe Ohai::System, 'Linux Block Device Plugin' do
|
|
56
56
|
end
|
57
57
|
|
58
58
|
allow(File).to receive(:exists?).with(Regexp.new(disk)) do |arg|
|
59
|
-
filepath = arg.split(
|
59
|
+
filepath = arg.split("/")
|
60
60
|
checks[filepath.last].nil? ? false : true
|
61
61
|
end
|
62
62
|
|
63
63
|
allow(File).to receive(:basename) do |arg|
|
64
|
-
arg.split(
|
64
|
+
arg.split("/").last
|
65
65
|
end
|
66
66
|
end
|
67
67
|
end
|
68
68
|
|
69
|
-
it
|
69
|
+
it "should collect all relevant data from disks" do
|
70
70
|
@plugin.run
|
71
71
|
DISKS.each do |disk, checks|
|
72
72
|
expect(@plugin[:block_device][disk.to_sym]).to include(checks)
|
@@ -16,9 +16,9 @@
|
|
16
16
|
# limitations under the License.
|
17
17
|
#
|
18
18
|
|
19
|
-
require
|
19
|
+
require "tempfile"
|
20
20
|
|
21
|
-
require File.expand_path(File.dirname(__FILE__) +
|
21
|
+
require File.expand_path(File.dirname(__FILE__) + "/../../../spec_helper.rb")
|
22
22
|
|
23
23
|
shared_examples "Common cpu info" do |total_cpu, real_cpu|
|
24
24
|
describe "cpu" do
|
@@ -89,7 +89,7 @@ clflush size : 32
|
|
89
89
|
end
|
90
90
|
|
91
91
|
let(:tempfile_handle) do
|
92
|
-
tempfile = Tempfile.new(
|
92
|
+
tempfile = Tempfile.new("ohai-rspec-proc-cpuinfo")
|
93
93
|
tempfile.write cpuinfo_contents
|
94
94
|
tempfile.rewind
|
95
95
|
tempfile
|
@@ -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, "Linux filesystem plugin" do
|
22
22
|
let (:plugin) { get_plugin("linux/filesystem2") }
|
@@ -166,7 +166,7 @@ MOUNT
|
|
166
166
|
|
167
167
|
it "should set mount_options to an array of values from mount" do
|
168
168
|
plugin.run
|
169
|
-
expect(plugin[:filesystem2]["by_pair"]["/dev/mapper/sys.vg-special.lv,/special"][:mount_options]).to eq(
|
169
|
+
expect(plugin[:filesystem2]["by_pair"]["/dev/mapper/sys.vg-special.lv,/special"][:mount_options]).to eq(%w{ro noatime})
|
170
170
|
end
|
171
171
|
end
|
172
172
|
|
@@ -338,7 +338,7 @@ MOUNTS
|
|
338
338
|
|
339
339
|
it "should set mount_options to an array of values from /proc/mounts" do
|
340
340
|
plugin.run
|
341
|
-
expect(plugin[:filesystem2]["by_pair"]["/dev/mapper/sys.vg-special.lv,/special"][:mount_options]).to eq(
|
341
|
+
expect(plugin[:filesystem2]["by_pair"]["/dev/mapper/sys.vg-special.lv,/special"][:mount_options]).to eq(%w{ro noatime attr2 noquota})
|
342
342
|
end
|
343
343
|
end
|
344
344
|
|
@@ -385,9 +385,9 @@ BLKID_TYPE
|
|
385
385
|
|
386
386
|
it "should provide a devices view with all mountpoints" do
|
387
387
|
plugin.run
|
388
|
-
expect(plugin[:filesystem2]["by_device"]["/dev/mapper/sys.vg-root.lv"][:mounts]).to eq([
|
389
|
-
expect(plugin[:filesystem2]["by_device"]["/dev/mapper/sys.vg-home.lv"][:mounts]).to eq([
|
390
|
-
expect(plugin[:filesystem2]["by_device"]["tmpfs"][:mounts]).to eq([
|
388
|
+
expect(plugin[:filesystem2]["by_device"]["/dev/mapper/sys.vg-root.lv"][:mounts]).to eq(["/", "/var/chroot"])
|
389
|
+
expect(plugin[:filesystem2]["by_device"]["/dev/mapper/sys.vg-home.lv"][:mounts]).to eq(["/home", "/home2"])
|
390
|
+
expect(plugin[:filesystem2]["by_device"]["tmpfs"][:mounts]).to eq(["/lib/init/rw", "/dev/shm"])
|
391
391
|
end
|
392
392
|
end
|
393
393
|
|
@@ -431,7 +431,7 @@ BLKID_TYPE
|
|
431
431
|
|
432
432
|
it "should provide a mounts view with all devices" do
|
433
433
|
plugin.run
|
434
|
-
expect(plugin[:filesystem2]["by_mountpoint"]["/mnt"][:devices]).to eq([
|
434
|
+
expect(plugin[:filesystem2]["by_mountpoint"]["/mnt"][:devices]).to eq(["/dev/sdb1", "/dev/sdc1"])
|
435
435
|
end
|
436
436
|
end
|
437
437
|
end
|