ohai 8.26.1 → 13.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (188) hide show
  1. checksums.yaml +5 -5
  2. data/Gemfile +3 -4
  3. data/Rakefile +14 -0
  4. data/lib/ohai/application.rb +1 -0
  5. data/lib/ohai/config.rb +2 -88
  6. data/lib/ohai/dsl/plugin.rb +0 -4
  7. data/lib/ohai/exception.rb +0 -1
  8. data/lib/ohai/loader.rb +11 -2
  9. data/lib/ohai/log.rb +3 -1
  10. data/lib/ohai/mixin/command.rb +1 -318
  11. data/lib/ohai/mixin/do_metadata.rb +47 -0
  12. data/lib/ohai/mixin/ec2_metadata.rb +2 -29
  13. data/lib/ohai/mixin/gce_metadata.rb +0 -37
  14. data/lib/ohai/mixin/http_helper.rb +56 -0
  15. data/lib/ohai/mixin/network_constants.rb +0 -5
  16. data/lib/ohai/plugins/cloud.rb +144 -157
  17. data/lib/ohai/plugins/darwin/filesystem.rb +68 -22
  18. data/lib/ohai/plugins/digital_ocean.rb +24 -42
  19. data/lib/ohai/plugins/dmi.rb +81 -77
  20. data/lib/ohai/plugins/ec2.rb +33 -60
  21. data/lib/ohai/plugins/gce.rb +3 -1
  22. data/lib/ohai/plugins/hostname.rb +1 -16
  23. data/lib/ohai/plugins/linux/filesystem.rb +130 -81
  24. data/lib/ohai/plugins/linux/mdadm.rb +3 -45
  25. data/lib/ohai/plugins/linux/network.rb +1 -26
  26. data/lib/ohai/plugins/linux/platform.rb +4 -2
  27. data/lib/ohai/plugins/linux/virtualization.rb +1 -5
  28. data/lib/ohai/plugins/scala.rb +1 -13
  29. data/lib/ohai/plugins/solaris2/network.rb +1 -2
  30. data/lib/ohai/plugins/uptime.rb +0 -9
  31. data/lib/ohai/plugins/windows/cpu.rb +2 -1
  32. data/lib/ohai/plugins/windows/network.rb +1 -1
  33. data/lib/ohai/runner.rb +0 -5
  34. data/lib/ohai/system.rb +38 -8
  35. data/lib/ohai/version.rb +2 -2
  36. data/ohai.gemspec +1 -1
  37. data/spec/functional/application_spec.rb +0 -40
  38. data/spec/functional/plugins/powershell_spec.rb +1 -1
  39. data/spec/functional/plugins/root_group_spec.rb +1 -1
  40. data/spec/functional/plugins/windows/uptime_spec.rb +1 -1
  41. data/spec/ohai_spec.rb +1 -1
  42. data/spec/support/integration_helper.rb +17 -0
  43. data/spec/support/platform_helpers.rb +17 -0
  44. data/spec/unit/application_spec.rb +0 -1
  45. data/spec/unit/config_spec.rb +0 -111
  46. data/spec/unit/dsl/plugin_spec.rb +1 -1
  47. data/spec/unit/hints_spec.rb +1 -1
  48. data/spec/unit/loader_spec.rb +26 -1
  49. data/spec/unit/mixin/command_spec.rb +1 -69
  50. data/spec/unit/mixin/ec2_metadata_spec.rb +1 -1
  51. data/spec/unit/mixin/softlayer_metadata_spec.rb +1 -1
  52. data/spec/unit/plugin_config_spec.rb +0 -1
  53. data/spec/unit/plugins/abort_spec.rb +1 -1
  54. data/spec/unit/plugins/aix/cpu_spec.rb +1 -1
  55. data/spec/unit/plugins/aix/filesystem_spec.rb +2 -1
  56. data/spec/unit/plugins/aix/hostname_spec.rb +1 -1
  57. data/spec/unit/plugins/aix/kernel_spec.rb +1 -1
  58. data/spec/unit/plugins/aix/memory_spec.rb +1 -1
  59. data/spec/unit/plugins/aix/network_spec.rb +1 -1
  60. data/spec/unit/plugins/aix/os_spec.rb +1 -1
  61. data/spec/unit/plugins/aix/platform_spec.rb +1 -1
  62. data/spec/unit/plugins/aix/uptime_spec.rb +1 -1
  63. data/spec/unit/plugins/aix/virtualization_spec.rb +1 -1
  64. data/spec/unit/plugins/azure_spec.rb +1 -1
  65. data/spec/unit/plugins/bsd/filesystem_spec.rb +1 -1
  66. data/spec/unit/plugins/bsd/virtualization_spec.rb +1 -1
  67. data/spec/unit/plugins/c_spec.rb +1 -1
  68. data/spec/unit/plugins/chef_spec.rb +1 -2
  69. data/spec/unit/plugins/cloud_spec.rb +210 -50
  70. data/spec/unit/plugins/darwin/cpu_spec.rb +1 -1
  71. data/spec/unit/plugins/darwin/filesystem_spec.rb +62 -13
  72. data/spec/unit/plugins/darwin/hardware_spec.rb +2 -2
  73. data/spec/unit/plugins/darwin/hostname_spec.rb +1 -1
  74. data/spec/unit/plugins/darwin/kernel_spec.rb +1 -1
  75. data/spec/unit/plugins/darwin/memory_spec.rb +1 -1
  76. data/spec/unit/plugins/darwin/network_spec.rb +1 -1
  77. data/spec/unit/plugins/darwin/platform_spec.rb +1 -1
  78. data/spec/unit/plugins/darwin/system_profiler_spec.rb +2 -9
  79. data/spec/unit/plugins/darwin/virtualization_spec.rb +1 -1
  80. data/spec/unit/plugins/digital_ocean_spec.rb +39 -110
  81. data/spec/unit/plugins/dmi_spec.rb +1 -1
  82. data/spec/unit/plugins/ec2_spec.rb +10 -62
  83. data/spec/unit/plugins/elixir_spec.rb +1 -1
  84. data/spec/unit/plugins/erlang_spec.rb +1 -1
  85. data/spec/unit/plugins/eucalyptus_spec.rb +1 -1
  86. data/spec/unit/plugins/fail_spec.rb +1 -1
  87. data/spec/unit/plugins/freebsd/cpu_spec.rb +1 -1
  88. data/spec/unit/plugins/freebsd/hostname_spec.rb +1 -1
  89. data/spec/unit/plugins/freebsd/kernel_spec.rb +1 -1
  90. data/spec/unit/plugins/freebsd/os_spec.rb +1 -1
  91. data/spec/unit/plugins/freebsd/platform_spec.rb +1 -1
  92. data/spec/unit/plugins/gce_spec.rb +1 -1
  93. data/spec/unit/plugins/go_spec.rb +1 -1
  94. data/spec/unit/plugins/groovy_spec.rb +1 -1
  95. data/spec/unit/plugins/haskell_spec.rb +1 -1
  96. data/spec/unit/plugins/hostname_spec.rb +16 -41
  97. data/spec/unit/plugins/init_package_spec.rb +1 -1
  98. data/spec/unit/plugins/ip_scopes_spec.rb +18 -6
  99. data/spec/unit/plugins/java_spec.rb +1 -1
  100. data/spec/unit/plugins/joyent_spec.rb +17 -1
  101. data/spec/unit/plugins/kernel_spec.rb +1 -1
  102. data/spec/unit/plugins/linode_spec.rb +1 -1
  103. data/spec/unit/plugins/linux/block_device_spec.rb +1 -1
  104. data/spec/unit/plugins/linux/cpu_spec.rb +1 -2
  105. data/spec/unit/plugins/linux/filesystem_spec.rb +207 -201
  106. data/spec/unit/plugins/linux/fips_spec.rb +1 -1
  107. data/spec/unit/plugins/linux/hostname_spec.rb +1 -1
  108. data/spec/unit/plugins/linux/hostnamectl_spec.rb +1 -1
  109. data/spec/unit/plugins/linux/kernel_spec.rb +1 -1
  110. data/spec/unit/plugins/linux/lsb_spec.rb +1 -1
  111. data/spec/unit/plugins/linux/machineid_spec.rb +1 -1
  112. data/spec/unit/plugins/linux/mdadm_spec.rb +2 -68
  113. data/spec/unit/plugins/linux/memory_spec.rb +1 -1
  114. data/spec/unit/plugins/linux/network_spec.rb +3 -44
  115. data/spec/unit/plugins/linux/platform_spec.rb +4 -4
  116. data/spec/unit/plugins/linux/sessions_spec.rb +1 -1
  117. data/spec/unit/plugins/linux/uptime_spec.rb +1 -1
  118. data/spec/unit/plugins/linux/virtualization_spec.rb +1 -28
  119. data/spec/unit/plugins/lua_spec.rb +1 -1
  120. data/spec/unit/plugins/mono_spec.rb +1 -1
  121. data/spec/unit/plugins/netbsd/hostname_spec.rb +1 -1
  122. data/spec/unit/plugins/netbsd/kernel_spec.rb +1 -1
  123. data/spec/unit/plugins/netbsd/platform_spec.rb +1 -1
  124. data/spec/unit/plugins/network_spec.rb +1 -1
  125. data/spec/unit/plugins/nodejs_spec.rb +1 -1
  126. data/spec/unit/plugins/ohai_spec.rb +1 -1
  127. data/spec/unit/plugins/ohai_time_spec.rb +1 -1
  128. data/spec/unit/plugins/openbsd/hostname_spec.rb +1 -1
  129. data/spec/unit/plugins/openbsd/kernel_spec.rb +1 -1
  130. data/spec/unit/plugins/openbsd/platform_spec.rb +1 -1
  131. data/spec/unit/plugins/openstack_spec.rb +2 -3
  132. data/spec/unit/plugins/os_spec.rb +1 -1
  133. data/spec/unit/plugins/packages_spec.rb +1 -1
  134. data/spec/unit/plugins/passwd_spec.rb +17 -1
  135. data/spec/unit/plugins/perl_spec.rb +1 -1
  136. data/spec/unit/plugins/php_spec.rb +1 -1
  137. data/spec/unit/plugins/platform_spec.rb +1 -1
  138. data/spec/unit/plugins/powershell_spec.rb +1 -1
  139. data/spec/unit/plugins/python_spec.rb +1 -1
  140. data/spec/unit/plugins/rackspace_spec.rb +1 -2
  141. data/spec/unit/plugins/root_group_spec.rb +2 -2
  142. data/spec/unit/plugins/ruby_spec.rb +1 -1
  143. data/spec/unit/plugins/rust_spec.rb +1 -1
  144. data/spec/unit/plugins/scala_spec.rb +3 -37
  145. data/spec/unit/plugins/shard_spec.rb +1 -1
  146. data/spec/unit/plugins/shells_spec.rb +1 -1
  147. data/spec/unit/plugins/softlayer_spec.rb +1 -1
  148. data/spec/unit/plugins/solaris2/cpu_spec.rb +1 -1
  149. data/spec/unit/plugins/solaris2/dmi_spec.rb +1 -1
  150. data/spec/unit/plugins/solaris2/hostname_spec.rb +1 -1
  151. data/spec/unit/plugins/solaris2/kernel_spec.rb +1 -1
  152. data/spec/unit/plugins/solaris2/memory_spec.rb +1 -1
  153. data/spec/unit/plugins/solaris2/network_spec.rb +7 -4
  154. data/spec/unit/plugins/solaris2/platform_spec.rb +1 -1
  155. data/spec/unit/plugins/solaris2/virtualization_spec.rb +1 -1
  156. data/spec/unit/plugins/solaris2/zpools_spec.rb +1 -1
  157. data/spec/unit/plugins/ssh_host_keys_spec.rb +1 -1
  158. data/spec/unit/plugins/sysconf_spec.rb +1 -1
  159. data/spec/unit/plugins/timezone_spec.rb +1 -1
  160. data/spec/unit/plugins/virtualbox_spec.rb +1 -1
  161. data/spec/unit/plugins/vmware_spec.rb +2 -1
  162. data/spec/unit/plugins/windows/cpu_spec.rb +9 -2
  163. data/spec/unit/plugins/windows/fips_spec.rb +1 -1
  164. data/spec/unit/plugins/windows/memory_spec.rb +1 -1
  165. data/spec/unit/plugins/windows/uptime_spec.rb +1 -1
  166. data/spec/unit/plugins/windows/virtualization_spec.rb +1 -1
  167. data/spec/unit/provides_map_spec.rb +1 -1
  168. data/spec/unit/runner_spec.rb +1 -1
  169. data/spec/unit/system_spec.rb +68 -76
  170. data/spec/unit/util/file_helper_spec.rb +1 -1
  171. data/spec/unit/util/ip_helper_spec.rb +1 -1
  172. metadata +6 -20
  173. data/lib/ohai/plugins/cloud_v2.rb +0 -315
  174. data/lib/ohai/plugins/darwin/filesystem2.rb +0 -107
  175. data/lib/ohai/plugins/linux/filesystem2.rb +0 -223
  176. data/lib/ohai/plugins/linux/lspci.rb +0 -76
  177. data/lib/ohai/plugins/network_listeners.rb +0 -60
  178. data/lib/ohai/plugins/sigar/cpu.rb +0 -44
  179. data/lib/ohai/plugins/sigar/filesystem.rb +0 -50
  180. data/lib/ohai/plugins/sigar/memory.rb +0 -39
  181. data/lib/ohai/plugins/sigar/network.rb +0 -168
  182. data/lib/ohai/plugins/sigar/network_route.rb +0 -64
  183. data/lib/ohai/plugins/sigar/platform.rb +0 -30
  184. data/spec/unit/plugins/cloud_v2_spec.rb +0 -389
  185. data/spec/unit/plugins/darwin/filesystem2_spec.rb +0 -139
  186. data/spec/unit/plugins/linux/filesystem2_spec.rb +0 -437
  187. data/spec/unit/plugins/linux/lspci_spec.rb +0 -133
  188. data/spec/unit/plugins/sigar/network_route_spec.rb +0 -148
@@ -16,7 +16,7 @@
16
16
  # limitations under the License.
17
17
  #
18
18
 
19
- require File.expand_path(File.dirname(__FILE__) + "/../../../spec_helper.rb")
19
+ require_relative "../../../spec_helper.rb"
20
20
 
21
21
  shared_examples "a cpu" do |cpu_no|
22
22
  describe "cpu #{cpu_no}" do
@@ -32,8 +32,13 @@ shared_examples "a cpu" do |cpu_no|
32
32
  expect(@plugin[:cpu]["#{cpu_no}"][:vendor_id]).to eq("GenuineIntel")
33
33
  end
34
34
 
35
- it "should set model_name to Intel64 Family 6 Model 70 Stepping 1" do
35
+ it "should set model_name to Intel(R) Core(TM) i7-4500U CPU @ 1.80GHz" do
36
36
  expect(@plugin[:cpu]["#{cpu_no}"][:model_name])
37
+ .to eq("Intel(R) Core(TM) i7-4500U CPU @ 1.80GHz")
38
+ end
39
+
40
+ it "should set description to Intel64 Family 6 Model 70 Stepping 1" do
41
+ expect(@plugin[:cpu]["#{cpu_no}"][:description])
37
42
  .to eq("Intel64 Family 6 Model 70 Stepping 1")
38
43
  end
39
44
 
@@ -64,6 +69,7 @@ describe Ohai::System, "Windows cpu plugin" do
64
69
  @double_wmi_instance = instance_double(WmiLite::Wmi)
65
70
 
66
71
  @processors = [{ "description" => "Intel64 Family 6 Model 70 Stepping 1",
72
+ "name" => "Intel(R) Core(TM) i7-4500U CPU @ 1.80GHz",
67
73
  "deviceid" => "CPU0",
68
74
  "family" => 2,
69
75
  "manufacturer" => "GenuineIntel",
@@ -75,6 +81,7 @@ describe Ohai::System, "Windows cpu plugin" do
75
81
  "l2cachesize" => 64 },
76
82
 
77
83
  { "description" => "Intel64 Family 6 Model 70 Stepping 1",
84
+ "name" => "Intel(R) Core(TM) i7-4500U CPU @ 1.80GHz",
78
85
  "deviceid" => "CPU1",
79
86
  "family" => 2,
80
87
  "manufacturer" => "GenuineIntel",
@@ -16,7 +16,7 @@
16
16
  # limitations under the License.
17
17
  #
18
18
 
19
- require File.expand_path(File.dirname(__FILE__) + "/../../../spec_helper.rb")
19
+ require_relative "../../../spec_helper.rb"
20
20
 
21
21
  describe Ohai::System, "plugin fips", :windows_only do
22
22
  let(:enabled) { 0 }
@@ -14,7 +14,7 @@
14
14
  # limitations under the License.
15
15
  #
16
16
 
17
- require File.expand_path(File.dirname(__FILE__) + "/../../../spec_helper.rb")
17
+ require_relative "../../../spec_helper.rb"
18
18
 
19
19
  describe Ohai::System, "Windows memory plugin", :windows_only do
20
20
  before do
@@ -16,7 +16,7 @@
16
16
  # limitations under the License.
17
17
  #
18
18
 
19
- require File.expand_path(File.dirname(__FILE__) + "/../../../spec_helper.rb")
19
+ require_relative "../../../spec_helper.rb"
20
20
 
21
21
  describe Ohai::System, "Windows plugin uptime" do
22
22
 
@@ -18,7 +18,7 @@
18
18
  # limitations under the License.
19
19
  #
20
20
 
21
- require File.expand_path(File.dirname(__FILE__) + "/../../../spec_helper.rb")
21
+ require_relative "../../../spec_helper.rb"
22
22
 
23
23
  describe Ohai::System, "Windows virtualization platform" do
24
24
  let(:plugin) { get_plugin("windows/virtualization") }
@@ -17,7 +17,7 @@
17
17
  # limitations under the License
18
18
  #
19
19
 
20
- require File.expand_path(File.dirname(__FILE__) + "/../spec_helper.rb")
20
+ require_relative "../spec_helper.rb"
21
21
 
22
22
  describe Ohai::ProvidesMap do
23
23
 
@@ -17,7 +17,7 @@
17
17
  # limitations under the License
18
18
  #
19
19
 
20
- require File.expand_path(File.dirname(__FILE__) + "/../spec_helper.rb")
20
+ require_relative "../spec_helper.rb"
21
21
 
22
22
  describe Ohai::Runner, "run_plugin" do
23
23
  let(:safe_run) { true }
@@ -1,7 +1,7 @@
1
1
  #
2
2
  # Author:: Adam Jacob (<adam@chef.io>)
3
3
  # Author:: Claire McQuin (<claire@chef.io>)
4
- # Copyright:: Copyright (c) 2008-2016 Chef Software, Inc.
4
+ # Copyright:: Copyright (c) 2008-2017, 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");
@@ -17,13 +17,14 @@
17
17
  # limitations under the License.
18
18
  #
19
19
 
20
- require File.expand_path(File.dirname(__FILE__) + "/../spec_helper.rb")
20
+ require_relative "../spec_helper.rb"
21
21
  require "ohai/mixin/os"
22
22
 
23
23
  describe "Ohai::System" do
24
24
  extend IntegrationSupport
25
25
 
26
- let(:ohai) { Ohai::System.new }
26
+ let(:ohai_external) {}
27
+ let(:ohai) { Ohai::System.new({ invoked_from_cli: true }) }
27
28
 
28
29
  describe "#initialize" do
29
30
  it "returns an Ohai::System object" do
@@ -38,24 +39,11 @@ describe "Ohai::System" do
38
39
  expect(ohai.v6_dependency_solver).to be_a_kind_of(Hash)
39
40
  end
40
41
 
41
- it "merges deprecated config settings into the ohai config context" do
42
- expect(Ohai::Log).to receive(:warn).
43
- with(/Ohai::Config\[:disabled_plugins\] is deprecated/)
44
- Ohai::Config[:disabled_plugins] = [ :Foo, :Baz ]
45
- expect(Ohai::Config).to receive(:merge_deprecated_config).
46
- and_call_original
47
- Ohai::System.new
48
- expect(Ohai.config[:disabled_plugins]).to eq([ :Foo, :Baz ])
49
- end
50
-
51
42
  it "merges provided configuration options into the ohai config context" do
52
43
  config = {
53
44
  disabled_plugins: [ :Foo, :Baz ],
54
45
  directory: "/some/extra/plugins",
55
- critical_plugins: [ :Foo, :Bar ],
56
46
  }
57
- allow(Ohai::Config).to receive(:merge_deprecated_config)
58
- expect(Ohai.config).to receive(:merge!).with(config).and_call_original
59
47
  Ohai::System.new(config)
60
48
  config.each do |option, value|
61
49
  expect(Ohai.config[option]).to eq(value)
@@ -67,57 +55,36 @@ describe "Ohai::System" do
67
55
 
68
56
  it "adds directory to plugin_path" do
69
57
  Ohai.config[:directory] = directory
70
- Ohai::System.new
58
+ Ohai::System.new({ invoked_from_cli: true })
71
59
  expect(Ohai.config[:plugin_path]).to include(directory)
72
60
  end
73
61
  end
74
62
 
75
- shared_examples_for "appendable deprecated configuration option" do
76
- it "logs a warning and configures the option on the ohai config context" do
77
- Ohai::Config[option] << value
78
- expect(Ohai::Log).to receive(:warn).
79
- with(/Ohai::Config\[:#{option}\] is deprecated/)
80
- Ohai::System.new
81
- expect(Ohai.config[option]).to include(value)
82
- end
83
- end
84
-
85
- context "when a top-level hints_path is configured" do
86
- include_examples "appendable deprecated configuration option" do
87
- let(:option) { :hints_path }
88
- let(:value) { "/path/to/hints" }
89
- end
90
- end
91
-
92
- context "when a top-level plugin_path is configured" do
93
- include_examples "appendable deprecated configuration option" do
94
- let(:option) { :plugin_path }
95
- let(:value) { "/path/to/plugins" }
96
- end
97
- end
98
-
99
- context "first time configuration" do
100
- before { allow(Ohai::Log).to receive(:configured?).and_return(false) }
101
-
63
+ context "when testing the intializer that does way too much" do
102
64
  it "configures logging" do
103
65
  log_level = :debug
104
66
  Ohai.config[:log_level] = log_level
105
67
  expect(Ohai::Log).to receive(:level=).with(log_level)
106
- Ohai::System.new
68
+ Ohai::System.new({ invoked_from_cli: true })
107
69
  end
108
70
 
109
71
  it "resolves log_level when set to :auto" do
110
72
  expect(Ohai::Log).to receive(:level=).with(:info)
111
- Ohai::System.new
73
+ Ohai::System.new({ invoked_from_cli: true })
112
74
  end
113
- end
114
75
 
115
- context "after first time configuration" do
116
- before { allow(Ohai::Log).to receive(:configured?).and_return(true) }
76
+ context "when called externally" do
77
+ it "does not configure logging" do
78
+ log_level = :debug
79
+ Ohai.config[:log_level] = log_level
80
+ expect(Ohai::Log).not_to receive(:level=).with(log_level)
81
+ Ohai::System.new()
82
+ end
117
83
 
118
- it "configures logging" do
119
- expect(Ohai::Log).not_to receive(:init).with(Ohai.config[:log_location])
120
- Ohai::System.new
84
+ it "does not resolve log_level when set to :auto" do
85
+ expect(Ohai::Log).not_to receive(:level=).with(:info)
86
+ Ohai::System.new()
87
+ end
121
88
  end
122
89
  end
123
90
  end
@@ -199,6 +166,8 @@ EOF
199
166
  ohai.all_plugins
200
167
  expect(ohai.data[:zoo]).to eq("animals")
201
168
  expect(ohai.data[:park]).to eq("plants")
169
+ expect(ohai.data[:zoo]).to be_frozen
170
+ expect(ohai.data[:park]).to be_frozen
202
171
  end
203
172
 
204
173
  describe "when using :disabled_plugins" do
@@ -338,15 +307,6 @@ Ohai.plugin(:Park) do
338
307
  park("plants")
339
308
  end
340
309
  end
341
- EOF
342
-
343
- with_plugin("fails.rb", <<EOF)
344
- Ohai.plugin(:Fails) do
345
- provides 'fails'
346
- collect_data(:default) do
347
- fail 'thing'
348
- end
349
- end
350
310
  EOF
351
311
 
352
312
  it "should collect data from all the plugins" do
@@ -354,6 +314,8 @@ EOF
354
314
  ohai.all_plugins
355
315
  expect(ohai.data[:zoo]).to eq("animals")
356
316
  expect(ohai.data[:park]).to eq("plants")
317
+ expect(ohai.data[:zoo]).to be_frozen
318
+ expect(ohai.data[:park]).to be_frozen
357
319
  end
358
320
 
359
321
  it "should write an error to Ohai::Log" do
@@ -381,21 +343,6 @@ EOF
381
343
  expect(ohai.data[:park]).to eq("plants")
382
344
  end
383
345
  end
384
-
385
- describe "when using :critical_plugins" do
386
- before do
387
- Ohai.config[:critical_plugins] = [ :Fails ]
388
- end
389
- after do
390
- Ohai.config[:critical_plugins] = []
391
- end
392
-
393
- it "should fail when critical plugins fail" do
394
- Ohai.config[:plugin_path] = [ path_to(".") ]
395
- expect { ohai.all_plugins }.to raise_error(Ohai::Exceptions::CriticalPluginFailure)
396
- end
397
-
398
- end
399
346
  end
400
347
 
401
348
  when_plugins_directory "contains v6 & v7 plugins in different directories" do
@@ -764,4 +711,49 @@ EOF
764
711
  end
765
712
  end
766
713
 
714
+ describe "when loading a specific plugin path" do
715
+ when_plugins_directory "contains v7 plugins" do
716
+ with_plugin("my_cookbook/canteloupe.rb", <<-E)
717
+ Ohai.plugin(:Canteloupe) do
718
+ provides 'canteloupe'
719
+
720
+ collect_data do
721
+ canteloupe Mash.new
722
+ end
723
+ end
724
+ E
725
+
726
+ with_plugin("english/english.rb", <<-E)
727
+ Ohai.plugin(:English) do
728
+ provides 'canteloupe/english'
729
+
730
+ depends 'canteloupe'
731
+
732
+ collect_data do
733
+ canteloupe[:english] = Mash.new
734
+ canteloupe[:english][:version] = 2014
735
+ end
736
+ end
737
+ E
738
+
739
+ with_plugin("french/french.rb", <<-E)
740
+ Ohai.plugin(:French) do
741
+ provides 'canteloupe/french'
742
+
743
+ depends 'canteloupe'
744
+
745
+ collect_data do
746
+ canteloupe[:french] = Mash.new
747
+ canteloupe[:french][:version] = 2012
748
+ end
749
+ end
750
+ E
751
+
752
+ it "should run all the plugins" do
753
+ ohai.run_additional_plugins(@plugins_directory)
754
+ expect(ohai.data[:canteloupe][:english][:version]).to eq(2014)
755
+ expect(ohai.data[:canteloupe][:french][:version]).to eq(2012)
756
+ end
757
+ end
758
+ end
767
759
  end
@@ -16,7 +16,7 @@
16
16
  # See the License for the specific language governing permissions and
17
17
  # limitations under the License.
18
18
 
19
- require "spec_helper"
19
+ require_relative "../../spec_helper.rb"
20
20
  require "ohai/util/file_helper"
21
21
 
22
22
  class FileHelperMock
@@ -15,7 +15,7 @@
15
15
  # limitations under the License.
16
16
 
17
17
  require "ipaddress"
18
- require "spec_helper"
18
+ require_relative "../../spec_helper.rb"
19
19
  require "ohai/util/ip_helper"
20
20
 
21
21
  class IpHelperMock
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ohai
3
3
  version: !ruby/object:Gem::Version
4
- version: 8.26.1
4
+ version: 13.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Adam Jacob
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-01-24 00:00:00.000000000 Z
11
+ date: 2017-04-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: systemu
@@ -205,8 +205,10 @@ files:
205
205
  - lib/ohai/mixin/command.rb
206
206
  - lib/ohai/mixin/constant_helper.rb
207
207
  - lib/ohai/mixin/dmi_decode.rb
208
+ - lib/ohai/mixin/do_metadata.rb
208
209
  - lib/ohai/mixin/ec2_metadata.rb
209
210
  - lib/ohai/mixin/gce_metadata.rb
211
+ - lib/ohai/mixin/http_helper.rb
210
212
  - lib/ohai/mixin/network_constants.rb
211
213
  - lib/ohai/mixin/os.rb
212
214
  - lib/ohai/mixin/seconds_to_human.rb
@@ -228,11 +230,9 @@ files:
228
230
  - lib/ohai/plugins/c.rb
229
231
  - lib/ohai/plugins/chef.rb
230
232
  - lib/ohai/plugins/cloud.rb
231
- - lib/ohai/plugins/cloud_v2.rb
232
233
  - lib/ohai/plugins/command.rb
233
234
  - lib/ohai/plugins/darwin/cpu.rb
234
235
  - lib/ohai/plugins/darwin/filesystem.rb
235
- - lib/ohai/plugins/darwin/filesystem2.rb
236
236
  - lib/ohai/plugins/darwin/hardware.rb
237
237
  - lib/ohai/plugins/darwin/memory.rb
238
238
  - lib/ohai/plugins/darwin/network.rb
@@ -271,11 +271,9 @@ files:
271
271
  - lib/ohai/plugins/linux/block_device.rb
272
272
  - lib/ohai/plugins/linux/cpu.rb
273
273
  - lib/ohai/plugins/linux/filesystem.rb
274
- - lib/ohai/plugins/linux/filesystem2.rb
275
274
  - lib/ohai/plugins/linux/fips.rb
276
275
  - lib/ohai/plugins/linux/hostnamectl.rb
277
276
  - lib/ohai/plugins/linux/lsb.rb
278
- - lib/ohai/plugins/linux/lspci.rb
279
277
  - lib/ohai/plugins/linux/machineid.rb
280
278
  - lib/ohai/plugins/linux/mdadm.rb
281
279
  - lib/ohai/plugins/linux/memory.rb
@@ -290,7 +288,6 @@ files:
290
288
  - lib/ohai/plugins/netbsd/network.rb
291
289
  - lib/ohai/plugins/netbsd/platform.rb
292
290
  - lib/ohai/plugins/network.rb
293
- - lib/ohai/plugins/network_listeners.rb
294
291
  - lib/ohai/plugins/nodejs.rb
295
292
  - lib/ohai/plugins/ohai.rb
296
293
  - lib/ohai/plugins/ohai_time.rb
@@ -315,12 +312,6 @@ files:
315
312
  - lib/ohai/plugins/scala.rb
316
313
  - lib/ohai/plugins/shard.rb
317
314
  - lib/ohai/plugins/shells.rb
318
- - lib/ohai/plugins/sigar/cpu.rb
319
- - lib/ohai/plugins/sigar/filesystem.rb
320
- - lib/ohai/plugins/sigar/memory.rb
321
- - lib/ohai/plugins/sigar/network.rb
322
- - lib/ohai/plugins/sigar/network_route.rb
323
- - lib/ohai/plugins/sigar/platform.rb
324
315
  - lib/ohai/plugins/softlayer.rb
325
316
  - lib/ohai/plugins/solaris2/cpu.rb
326
317
  - lib/ohai/plugins/solaris2/dmi.rb
@@ -418,9 +409,7 @@ files:
418
409
  - spec/unit/plugins/c_spec.rb
419
410
  - spec/unit/plugins/chef_spec.rb
420
411
  - spec/unit/plugins/cloud_spec.rb
421
- - spec/unit/plugins/cloud_v2_spec.rb
422
412
  - spec/unit/plugins/darwin/cpu_spec.rb
423
- - spec/unit/plugins/darwin/filesystem2_spec.rb
424
413
  - spec/unit/plugins/darwin/filesystem_spec.rb
425
414
  - spec/unit/plugins/darwin/hardware_spec.rb
426
415
  - spec/unit/plugins/darwin/hardware_system_profiler_output.rb
@@ -457,14 +446,12 @@ files:
457
446
  - spec/unit/plugins/linode_spec.rb
458
447
  - spec/unit/plugins/linux/block_device_spec.rb
459
448
  - spec/unit/plugins/linux/cpu_spec.rb
460
- - spec/unit/plugins/linux/filesystem2_spec.rb
461
449
  - spec/unit/plugins/linux/filesystem_spec.rb
462
450
  - spec/unit/plugins/linux/fips_spec.rb
463
451
  - spec/unit/plugins/linux/hostname_spec.rb
464
452
  - spec/unit/plugins/linux/hostnamectl_spec.rb
465
453
  - spec/unit/plugins/linux/kernel_spec.rb
466
454
  - spec/unit/plugins/linux/lsb_spec.rb
467
- - spec/unit/plugins/linux/lspci_spec.rb
468
455
  - spec/unit/plugins/linux/machineid_spec.rb
469
456
  - spec/unit/plugins/linux/mdadm_spec.rb
470
457
  - spec/unit/plugins/linux/memory_spec.rb
@@ -501,7 +488,6 @@ files:
501
488
  - spec/unit/plugins/scala_spec.rb
502
489
  - spec/unit/plugins/shard_spec.rb
503
490
  - spec/unit/plugins/shells_spec.rb
504
- - spec/unit/plugins/sigar/network_route_spec.rb
505
491
  - spec/unit/plugins/softlayer_spec.rb
506
492
  - spec/unit/plugins/solaris2/cpu_spec.rb
507
493
  - spec/unit/plugins/solaris2/dmi_spec.rb
@@ -540,7 +526,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
540
526
  requirements:
541
527
  - - ">="
542
528
  - !ruby/object:Gem::Version
543
- version: 2.1.0
529
+ version: '2.3'
544
530
  required_rubygems_version: !ruby/object:Gem::Requirement
545
531
  requirements:
546
532
  - - ">="
@@ -548,7 +534,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
548
534
  version: '0'
549
535
  requirements: []
550
536
  rubyforge_project:
551
- rubygems_version: 2.7.4
537
+ rubygems_version: 2.6.11
552
538
  signing_key:
553
539
  specification_version: 4
554
540
  summary: Ohai profiles your system and emits JSON