ohai 8.10.0 → 8.11.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (256) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile +1 -2
  3. data/Rakefile +13 -4
  4. data/bin/ohai +3 -4
  5. data/lib/ohai.rb +4 -4
  6. data/lib/ohai/application.rb +7 -6
  7. data/lib/ohai/common/dmi.rb +56 -56
  8. data/lib/ohai/config.rb +12 -8
  9. data/lib/ohai/dsl.rb +3 -3
  10. data/lib/ohai/dsl/plugin.rb +5 -5
  11. data/lib/ohai/dsl/plugin/versionvi.rb +0 -1
  12. data/lib/ohai/dsl/plugin/versionvii.rb +1 -0
  13. data/lib/ohai/hints.rb +1 -1
  14. data/lib/ohai/loader.rb +7 -7
  15. data/lib/ohai/log.rb +1 -1
  16. data/lib/ohai/mash.rb +3 -2
  17. data/lib/ohai/mixin/command.rb +25 -23
  18. data/lib/ohai/mixin/dmi_decode.rb +10 -10
  19. data/lib/ohai/mixin/ec2_metadata.rb +40 -39
  20. data/lib/ohai/mixin/gce_metadata.rb +9 -9
  21. data/lib/ohai/mixin/network_constants.rb +1 -1
  22. data/lib/ohai/mixin/os.rb +3 -3
  23. data/lib/ohai/mixin/seconds_to_human.rb +0 -2
  24. data/lib/ohai/mixin/softlayer_metadata.rb +10 -10
  25. data/lib/ohai/mixin/string.rb +2 -2
  26. data/lib/ohai/plugin_config.rb +1 -1
  27. data/lib/ohai/plugins/aix/cpu.rb +2 -2
  28. data/lib/ohai/plugins/aix/filesystem.rb +2 -2
  29. data/lib/ohai/plugins/aix/memory.rb +2 -2
  30. data/lib/ohai/plugins/aix/network.rb +9 -10
  31. data/lib/ohai/plugins/aix/os.rb +2 -2
  32. data/lib/ohai/plugins/aix/uptime.rb +3 -3
  33. data/lib/ohai/plugins/aix/virtualization.rb +23 -23
  34. data/lib/ohai/plugins/azure.rb +32 -5
  35. data/lib/ohai/plugins/bsd/virtualization.rb +22 -22
  36. data/lib/ohai/plugins/c.rb +3 -3
  37. data/lib/ohai/plugins/chef.rb +1 -1
  38. data/lib/ohai/plugins/cloud.rb +59 -60
  39. data/lib/ohai/plugins/cloud_v2.rb +37 -39
  40. data/lib/ohai/plugins/darwin/cpu.rb +1 -1
  41. data/lib/ohai/plugins/darwin/filesystem2.rb +5 -5
  42. data/lib/ohai/plugins/darwin/memory.rb +5 -6
  43. data/lib/ohai/plugins/darwin/network.rb +7 -7
  44. data/lib/ohai/plugins/darwin/system_profiler.rb +32 -33
  45. data/lib/ohai/plugins/darwin/virtualization.rb +9 -9
  46. data/lib/ohai/plugins/digital_ocean.rb +16 -16
  47. data/lib/ohai/plugins/dmi.rb +6 -6
  48. data/lib/ohai/plugins/dragonflybsd/cpu.rb +2 -2
  49. data/lib/ohai/plugins/dragonflybsd/memory.rb +0 -1
  50. data/lib/ohai/plugins/dragonflybsd/network.rb +4 -4
  51. data/lib/ohai/plugins/dragonflybsd/os.rb +1 -1
  52. data/lib/ohai/plugins/ec2.rb +39 -15
  53. data/lib/ohai/plugins/elixir.rb +1 -1
  54. data/lib/ohai/plugins/erlang.rb +3 -3
  55. data/lib/ohai/plugins/eucalyptus.rb +16 -12
  56. data/lib/ohai/plugins/freebsd/cpu.rb +2 -2
  57. data/lib/ohai/plugins/freebsd/memory.rb +0 -1
  58. data/lib/ohai/plugins/freebsd/network.rb +4 -4
  59. data/lib/ohai/plugins/freebsd/os.rb +1 -1
  60. data/lib/ohai/plugins/gce.rb +6 -6
  61. data/lib/ohai/plugins/hostname.rb +7 -7
  62. data/lib/ohai/plugins/init_package.rb +1 -1
  63. data/lib/ohai/plugins/ip_scopes.rb +9 -9
  64. data/lib/ohai/plugins/java.rb +1 -1
  65. data/lib/ohai/plugins/joyent.rb +7 -7
  66. data/lib/ohai/plugins/kernel.rb +8 -8
  67. data/lib/ohai/plugins/linode.rb +7 -4
  68. data/lib/ohai/plugins/linux/cpu.rb +5 -5
  69. data/lib/ohai/plugins/linux/filesystem.rb +16 -16
  70. data/lib/ohai/plugins/linux/filesystem2.rb +15 -15
  71. data/lib/ohai/plugins/linux/mdadm.rb +3 -3
  72. data/lib/ohai/plugins/linux/network.rb +85 -51
  73. data/lib/ohai/plugins/linux/platform.rb +24 -24
  74. data/lib/ohai/plugins/linux/virtualization.rb +8 -8
  75. data/lib/ohai/plugins/mono.rb +1 -1
  76. data/lib/ohai/plugins/netbsd/cpu.rb +1 -1
  77. data/lib/ohai/plugins/netbsd/network.rb +2 -2
  78. data/lib/ohai/plugins/network.rb +11 -11
  79. data/lib/ohai/plugins/network_listeners.rb +30 -26
  80. data/lib/ohai/plugins/ohai.rb +3 -3
  81. data/lib/ohai/plugins/openbsd/cpu.rb +4 -4
  82. data/lib/ohai/plugins/openbsd/memory.rb +4 -4
  83. data/lib/ohai/plugins/openbsd/network.rb +3 -3
  84. data/lib/ohai/plugins/openstack.rb +12 -12
  85. data/lib/ohai/plugins/os.rb +2 -2
  86. data/lib/ohai/plugins/packages.rb +22 -22
  87. data/lib/ohai/plugins/passwd.rb +4 -4
  88. data/lib/ohai/plugins/powershell.rb +9 -9
  89. data/lib/ohai/plugins/ps.rb +2 -2
  90. data/lib/ohai/plugins/python.rb +1 -1
  91. data/lib/ohai/plugins/rackspace.rb +13 -13
  92. data/lib/ohai/plugins/root_group.rb +4 -4
  93. data/lib/ohai/plugins/ruby.rb +6 -6
  94. data/lib/ohai/plugins/rust.rb +1 -1
  95. data/lib/ohai/plugins/sigar/cpu.rb +1 -1
  96. data/lib/ohai/plugins/sigar/filesystem.rb +1 -1
  97. data/lib/ohai/plugins/sigar/network.rb +13 -13
  98. data/lib/ohai/plugins/sigar/network_route.rb +34 -29
  99. data/lib/ohai/plugins/softlayer.rb +8 -7
  100. data/lib/ohai/plugins/solaris2/cpu.rb +19 -19
  101. data/lib/ohai/plugins/solaris2/dmi.rb +63 -63
  102. data/lib/ohai/plugins/solaris2/filesystem.rb +13 -13
  103. data/lib/ohai/plugins/solaris2/memory.rb +2 -2
  104. data/lib/ohai/plugins/solaris2/network.rb +5 -5
  105. data/lib/ohai/plugins/solaris2/virtualization.rb +18 -18
  106. data/lib/ohai/plugins/solaris2/zpools.rb +1 -1
  107. data/lib/ohai/plugins/ssh_host_key.rb +2 -2
  108. data/lib/ohai/plugins/uptime.rb +4 -5
  109. data/lib/ohai/plugins/virtualbox.rb +2 -2
  110. data/lib/ohai/plugins/virtualization.rb +17 -17
  111. data/lib/ohai/plugins/vmware.rb +2 -2
  112. data/lib/ohai/plugins/windows/cpu.rb +14 -14
  113. data/lib/ohai/plugins/windows/drivers.rb +8 -8
  114. data/lib/ohai/plugins/windows/filesystem.rb +4 -4
  115. data/lib/ohai/plugins/windows/memory.rb +1 -1
  116. data/lib/ohai/plugins/windows/network.rb +10 -10
  117. data/lib/ohai/plugins/windows/platform.rb +1 -2
  118. data/lib/ohai/plugins/windows/virtualization.rb +17 -17
  119. data/lib/ohai/provides_map.rb +7 -7
  120. data/lib/ohai/runner.rb +3 -3
  121. data/lib/ohai/system.rb +21 -20
  122. data/lib/ohai/util/file_helper.rb +1 -2
  123. data/lib/ohai/util/ip_helper.rb +4 -4
  124. data/lib/ohai/util/win32.rb +5 -5
  125. data/lib/ohai/util/win32/group_helper.rb +4 -5
  126. data/lib/ohai/version.rb +1 -1
  127. data/ohai.gemspec +7 -5
  128. data/spec/functional/application_spec.rb +23 -23
  129. data/spec/functional/loader_spec.rb +1 -1
  130. data/spec/functional/plugins/powershell_spec.rb +13 -13
  131. data/spec/functional/plugins/root_group_spec.rb +5 -5
  132. data/spec/ohai_spec.rb +1 -1
  133. data/spec/spec_helper.rb +9 -9
  134. data/spec/support/integration_helper.rb +7 -7
  135. data/spec/support/platform_helpers.rb +1 -1
  136. data/spec/unit/application_spec.rb +17 -17
  137. data/spec/unit/config_spec.rb +2 -2
  138. data/spec/unit/dsl/plugin_spec.rb +28 -28
  139. data/spec/unit/hints_spec.rb +3 -3
  140. data/spec/unit/loader_spec.rb +9 -9
  141. data/spec/unit/mixin/command_spec.rb +5 -5
  142. data/spec/unit/mixin/ec2_metadata_spec.rb +6 -6
  143. data/spec/unit/mixin/softlayer_metadata_spec.rb +19 -23
  144. data/spec/unit/plugin_config_spec.rb +5 -5
  145. data/spec/unit/plugins/abort_spec.rb +3 -3
  146. data/spec/unit/plugins/aix/cpu_spec.rb +1 -1
  147. data/spec/unit/plugins/aix/filesystem_spec.rb +25 -25
  148. data/spec/unit/plugins/aix/hostname_spec.rb +1 -2
  149. data/spec/unit/plugins/aix/kernel_spec.rb +3 -3
  150. data/spec/unit/plugins/aix/memory_spec.rb +8 -8
  151. data/spec/unit/plugins/aix/network_spec.rb +38 -38
  152. data/spec/unit/plugins/aix/os_spec.rb +1 -2
  153. data/spec/unit/plugins/aix/platform_spec.rb +1 -1
  154. data/spec/unit/plugins/aix/uptime_spec.rb +1 -1
  155. data/spec/unit/plugins/aix/virtualization_spec.rb +11 -11
  156. data/spec/unit/plugins/azure_spec.rb +118 -20
  157. data/spec/unit/plugins/bsd/filesystem_spec.rb +1 -1
  158. data/spec/unit/plugins/bsd/virtualization_spec.rb +4 -4
  159. data/spec/unit/plugins/c_spec.rb +12 -12
  160. data/spec/unit/plugins/chef_spec.rb +2 -2
  161. data/spec/unit/plugins/cloud_spec.rb +37 -37
  162. data/spec/unit/plugins/cloud_v2_spec.rb +64 -65
  163. data/spec/unit/plugins/darwin/cpu_spec.rb +1 -2
  164. data/spec/unit/plugins/darwin/filesystem2_spec.rb +7 -7
  165. data/spec/unit/plugins/darwin/filesystem_spec.rb +5 -5
  166. data/spec/unit/plugins/darwin/hostname_spec.rb +1 -4
  167. data/spec/unit/plugins/darwin/kernel_spec.rb +6 -10
  168. data/spec/unit/plugins/darwin/memory_spec.rb +5 -5
  169. data/spec/unit/plugins/darwin/network_spec.rb +352 -353
  170. data/spec/unit/plugins/darwin/platform_spec.rb +1 -2
  171. data/spec/unit/plugins/darwin/system_profiler_spec.rb +3 -3
  172. data/spec/unit/plugins/darwin/virtualization_spec.rb +6 -6
  173. data/spec/unit/plugins/digital_ocean_spec.rb +38 -37
  174. data/spec/unit/plugins/dmi_spec.rb +3 -3
  175. data/spec/unit/plugins/ec2_spec.rb +97 -88
  176. data/spec/unit/plugins/elixir_spec.rb +1 -2
  177. data/spec/unit/plugins/erlang_spec.rb +2 -2
  178. data/spec/unit/plugins/eucalyptus_spec.rb +19 -19
  179. data/spec/unit/plugins/fail_spec.rb +2 -2
  180. data/spec/unit/plugins/freebsd/cpu_spec.rb +14 -14
  181. data/spec/unit/plugins/freebsd/hostname_spec.rb +1 -2
  182. data/spec/unit/plugins/freebsd/kernel_spec.rb +2 -3
  183. data/spec/unit/plugins/freebsd/os_spec.rb +4 -5
  184. data/spec/unit/plugins/freebsd/platform_spec.rb +1 -2
  185. data/spec/unit/plugins/gce_spec.rb +9 -9
  186. data/spec/unit/plugins/go_spec.rb +1 -1
  187. data/spec/unit/plugins/groovy_spec.rb +1 -2
  188. data/spec/unit/plugins/hostname_spec.rb +1 -2
  189. data/spec/unit/plugins/init_package_spec.rb +1 -1
  190. data/spec/unit/plugins/ip_scopes_spec.rb +38 -38
  191. data/spec/unit/plugins/java_spec.rb +52 -1
  192. data/spec/unit/plugins/joyent_spec.rb +9 -11
  193. data/spec/unit/plugins/kernel_spec.rb +11 -12
  194. data/spec/unit/plugins/linode_spec.rb +29 -29
  195. data/spec/unit/plugins/linux/block_device_spec.rb +21 -21
  196. data/spec/unit/plugins/linux/cpu_spec.rb +3 -3
  197. data/spec/unit/plugins/linux/filesystem2_spec.rb +7 -7
  198. data/spec/unit/plugins/linux/filesystem_spec.rb +85 -86
  199. data/spec/unit/plugins/linux/hostname_spec.rb +1 -3
  200. data/spec/unit/plugins/linux/kernel_spec.rb +1 -1
  201. data/spec/unit/plugins/linux/lsb_spec.rb +1 -2
  202. data/spec/unit/plugins/linux/mdadm_spec.rb +4 -4
  203. data/spec/unit/plugins/linux/memory_spec.rb +29 -33
  204. data/spec/unit/plugins/linux/network_spec.rb +463 -245
  205. data/spec/unit/plugins/linux/platform_spec.rb +64 -65
  206. data/spec/unit/plugins/linux/uptime_spec.rb +1 -2
  207. data/spec/unit/plugins/linux/virtualization_spec.rb +42 -42
  208. data/spec/unit/plugins/lua_spec.rb +1 -2
  209. data/spec/unit/plugins/mono_spec.rb +1 -2
  210. data/spec/unit/plugins/netbsd/hostname_spec.rb +1 -2
  211. data/spec/unit/plugins/netbsd/kernel_spec.rb +1 -2
  212. data/spec/unit/plugins/netbsd/platform_spec.rb +1 -1
  213. data/spec/unit/plugins/network_spec.rb +118 -118
  214. data/spec/unit/plugins/nodejs_spec.rb +1 -1
  215. data/spec/unit/plugins/ohai_spec.rb +1 -1
  216. data/spec/unit/plugins/ohai_time_spec.rb +1 -2
  217. data/spec/unit/plugins/openbsd/hostname_spec.rb +1 -2
  218. data/spec/unit/plugins/openbsd/kernel_spec.rb +1 -2
  219. data/spec/unit/plugins/openbsd/platform_spec.rb +1 -2
  220. data/spec/unit/plugins/openstack_spec.rb +35 -37
  221. data/spec/unit/plugins/os_spec.rb +7 -8
  222. data/spec/unit/plugins/packages_spec.rb +118 -118
  223. data/spec/unit/plugins/passwd_spec.rb +18 -18
  224. data/spec/unit/plugins/perl_spec.rb +1 -1
  225. data/spec/unit/plugins/php_spec.rb +4 -4
  226. data/spec/unit/plugins/platform_spec.rb +8 -9
  227. data/spec/unit/plugins/powershell_spec.rb +3 -3
  228. data/spec/unit/plugins/python_spec.rb +1 -1
  229. data/spec/unit/plugins/rackspace_spec.rb +66 -68
  230. data/spec/unit/plugins/root_group_spec.rb +26 -26
  231. data/spec/unit/plugins/ruby_spec.rb +14 -15
  232. data/spec/unit/plugins/rust_spec.rb +2 -2
  233. data/spec/unit/plugins/sigar/network_route_spec.rb +36 -36
  234. data/spec/unit/plugins/softlayer_spec.rb +10 -10
  235. data/spec/unit/plugins/solaris2/cpu_spec.rb +20 -21
  236. data/spec/unit/plugins/solaris2/dmi_spec.rb +5 -6
  237. data/spec/unit/plugins/solaris2/filesystem.rb +5 -5
  238. data/spec/unit/plugins/solaris2/hostname_spec.rb +1 -1
  239. data/spec/unit/plugins/solaris2/kernel_spec.rb +3 -3
  240. data/spec/unit/plugins/solaris2/memory_spec.rb +5 -5
  241. data/spec/unit/plugins/solaris2/network_spec.rb +7 -8
  242. data/spec/unit/plugins/solaris2/platform_spec.rb +1 -1
  243. data/spec/unit/plugins/solaris2/virtualization_spec.rb +3 -5
  244. data/spec/unit/plugins/solaris2/zpools_spec.rb +6 -6
  245. data/spec/unit/plugins/ssh_host_keys_spec.rb +1 -1
  246. data/spec/unit/plugins/virtualbox_spec.rb +19 -19
  247. data/spec/unit/plugins/vmware_spec.rb +28 -28
  248. data/spec/unit/plugins/windows/cpu_spec.rb +46 -48
  249. data/spec/unit/plugins/windows/memory_spec.rb +5 -5
  250. data/spec/unit/plugins/windows/virtualization_spec.rb +163 -163
  251. data/spec/unit/provides_map_spec.rb +10 -10
  252. data/spec/unit/runner_spec.rb +10 -10
  253. data/spec/unit/system_spec.rb +19 -19
  254. data/spec/unit/util/file_helper_spec.rb +5 -6
  255. data/spec/unit/util/ip_helper_spec.rb +39 -39
  256. metadata +31 -4
@@ -18,13 +18,13 @@
18
18
  # limitations under the License.
19
19
  #
20
20
 
21
- require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper.rb')
21
+ require File.expand_path(File.dirname(__FILE__) + "/../../spec_helper.rb")
22
22
 
23
- describe Ohai::System, 'root_group plugin' do
23
+ describe Ohai::System, "root_group plugin" do
24
24
  let(:plugin) { get_plugin("root_group") }
25
25
 
26
- describe 'windows platform', :windows_only do
27
- let (:wmi) { wmi = WmiLite::Wmi.new }
26
+ describe "windows platform", :windows_only do
27
+ let (:wmi) { wmi = WmiLite::Wmi.new }
28
28
 
29
29
  it 'should return the system\'s administrators (root) group' do
30
30
  # Notethat the Win32_Group WMI provider can be slow if your
@@ -33,7 +33,7 @@ describe Ohai::System, 'root_group plugin' do
33
33
  # something to watch if you run this test in such an environment.
34
34
  groups = wmi.query("select * from Win32_Group where sid = 'S-1-5-32-544'")
35
35
  expect(groups.length).to eq(1)
36
- administrators_group = groups[0]['name'].downcase
36
+ administrators_group = groups[0]["name"].downcase
37
37
  plugin.run
38
38
  expect(plugin[:root_group].downcase).to be == administrators_group
39
39
  end
@@ -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 File.expand_path(File.dirname(__FILE__) + "/spec_helper.rb")
20
20
 
21
21
  describe Ohai do
22
22
 
@@ -1,16 +1,16 @@
1
- require 'rspec'
2
- require 'rspec/collection_matchers'
1
+ require "rspec"
2
+ require "rspec/collection_matchers"
3
3
 
4
4
  # require 'pry-debugger'
5
5
  # require 'pry-stack_explorer'
6
6
 
7
7
  $:.unshift(File.expand_path("../..", __FILE__))
8
- $:.unshift(File.dirname(__FILE__) + '/../lib')
8
+ $:.unshift(File.dirname(__FILE__) + "/../lib")
9
9
 
10
- require 'spec/support/platform_helpers'
11
- require 'spec/support/integration_helper'
12
- require 'wmi-lite'
13
- require 'ohai'
10
+ require "spec/support/platform_helpers"
11
+ require "spec/support/integration_helper"
12
+ require "wmi-lite"
13
+ require "ohai"
14
14
  Ohai.config[:log_level] = :error
15
15
 
16
16
  PLUGIN_PATH = File.expand_path("../../lib/ohai/plugins", __FILE__)
@@ -112,8 +112,8 @@ RSpec.configure do |config|
112
112
  config.filter_run_excluding :unix_only => true unless unix?
113
113
  config.filter_run_excluding :ruby_18_only => true unless ruby_18?
114
114
  config.filter_run_excluding :ruby_19_only => true unless ruby_19?
115
- config.filter_run_excluding :requires_root => true unless ENV['USER'] == 'root'
116
- config.filter_run_excluding :requires_unprivileged_user => true if ENV['USER'] == 'root'
115
+ config.filter_run_excluding :requires_root => true unless ENV["USER"] == "root"
116
+ config.filter_run_excluding :requires_unprivileged_user => true if ENV["USER"] == "root"
117
117
 
118
118
  config.run_all_when_everything_filtered = true
119
119
 
@@ -1,11 +1,11 @@
1
- require 'tmpdir'
1
+ require "tmpdir"
2
2
 
3
- module IntegrationSupport
3
+ module IntegrationSupport
4
4
  def when_plugins_directory(description, &block)
5
5
  context "When the plugins directory #{description}" do
6
6
 
7
7
  before(:each) do
8
- @plugins_directory = Dir.mktmpdir('ohai-plugins')
8
+ @plugins_directory = Dir.mktmpdir("ohai-plugins")
9
9
  end
10
10
 
11
11
  after(:each) do
@@ -21,12 +21,12 @@ module IntegrationSupport
21
21
  def with_plugin(plugin_path, contents)
22
22
  filename = path_to(plugin_path)
23
23
  dir = File.dirname(filename)
24
- FileUtils.mkdir_p(dir) unless dir == '.'
25
- File.open(filename, 'w') do |file|
24
+ FileUtils.mkdir_p(dir) unless dir == "."
25
+ File.open(filename, "w") do |file|
26
26
  file.write(contents)
27
27
  end
28
28
  end
29
-
29
+
30
30
  def path_to(plugin_path)
31
31
  File.expand_path(plugin_path, @plugins_directory)
32
32
  end
@@ -36,7 +36,7 @@ module IntegrationSupport
36
36
  with_plugin(plugin_path, contents)
37
37
  end
38
38
  end
39
-
39
+
40
40
  instance_eval(&block)
41
41
  end
42
42
  end
@@ -28,4 +28,4 @@ def freebsd?
28
28
  !!(RUBY_PLATFORM =~ /freebsd/)
29
29
  end
30
30
 
31
- DEV_NULL = windows? ? 'NUL' : '/dev/null'
31
+ DEV_NULL = windows? ? "NUL" : "/dev/null"
@@ -16,11 +16,11 @@
16
16
  # limitations under the License.
17
17
  #
18
18
 
19
- require_relative '../spec_helper'
19
+ require_relative "../spec_helper"
20
20
 
21
- require 'ohai/application'
21
+ require "ohai/application"
22
22
 
23
- RSpec.describe 'Ohai::Application' do
23
+ RSpec.describe "Ohai::Application" do
24
24
 
25
25
  let(:argv) { [] }
26
26
  let(:app) { Ohai::Application.new }
@@ -35,12 +35,12 @@ RSpec.describe 'Ohai::Application' do
35
35
  end
36
36
 
37
37
  describe '#configure_ohai' do
38
- describe 'loading configuration from a file' do
39
- let(:config_file) { '/local/workstation/config' }
40
- let(:config_loader) { instance_double('ChefConfig::WorkstationConfigLoader') }
38
+ describe "loading configuration from a file" do
39
+ let(:config_file) { "/local/workstation/config" }
40
+ let(:config_loader) { instance_double("ChefConfig::WorkstationConfigLoader") }
41
41
 
42
- context 'when specified on the command line' do
43
- let(:argv) { [ '-c', config_file ] }
42
+ context "when specified on the command line" do
43
+ let(:argv) { [ "-c", config_file ] }
44
44
 
45
45
  before(:each) do
46
46
  if windows?
@@ -54,13 +54,13 @@ RSpec.describe 'Ohai::Application' do
54
54
  end
55
55
  end
56
56
 
57
- it 'loads the configuration file' do
57
+ it "loads the configuration file" do
58
58
  expect(config_loader).to receive(:load)
59
59
  app.configure_ohai
60
60
  end
61
61
 
62
- context 'when the configuration file does not exist' do
63
- it 'terminates the application' do
62
+ context "when the configuration file does not exist" do
63
+ it "terminates the application" do
64
64
  expect(config_loader).to receive(:load).and_raise(ChefConfig::ConfigurationError)
65
65
  expect(Ohai::Application).to receive(:fatal!)
66
66
  app.configure_ohai
@@ -68,25 +68,25 @@ RSpec.describe 'Ohai::Application' do
68
68
  end
69
69
  end
70
70
 
71
- context 'when a local workstation config exists' do
71
+ context "when a local workstation config exists" do
72
72
  before(:each) do
73
73
  expect(ChefConfig::WorkstationConfigLoader).to receive(:new).
74
74
  with(nil, Ohai::Log).
75
75
  and_return(config_loader)
76
76
  end
77
77
 
78
- it 'loads the configuration file' do
78
+ it "loads the configuration file" do
79
79
  expect(config_loader).to receive(:load)
80
80
  app.configure_ohai
81
81
  end
82
82
  end
83
83
  end
84
84
 
85
- context 'when CLI options are provided' do
86
- let(:argv) { [ '-d', directory ] }
87
- let(:directory) { '/some/fantastic/plugins' }
85
+ context "when CLI options are provided" do
86
+ let(:argv) { [ "-d", directory ] }
87
+ let(:directory) { "/some/fantastic/plugins" }
88
88
 
89
- it 'does not generate deprecated config warnings for cli options' do
89
+ it "does not generate deprecated config warnings for cli options" do
90
90
  expect(Ohai::Log).to_not receive(:warn).
91
91
  with(/Ohai::Config\[:directory\] is deprecated/)
92
92
  app.configure_ohai
@@ -16,9 +16,9 @@
16
16
  # limitations under the License.
17
17
  #
18
18
 
19
- require_relative '../spec_helper'
19
+ require_relative "../spec_helper"
20
20
 
21
- require 'ohai/config'
21
+ require "ohai/config"
22
22
 
23
23
  RSpec.describe Ohai::Config do
24
24
 
@@ -124,33 +124,33 @@ end
124
124
 
125
125
  describe Ohai::DSL::Plugin::VersionVII do
126
126
  it "should not modify the plugin name when the plugin is named correctly" do
127
- plugin = Ohai.plugin(:FunkyVALIDpluginName) { }.new({ })
127
+ plugin = Ohai.plugin(:FunkyVALIDpluginName) {}.new({})
128
128
  expect(plugin.name).to eql(:FunkyVALIDpluginName)
129
129
  end
130
130
 
131
131
  describe "when the plugin is named incorrectly" do
132
132
  context "because the plugin name doesn't start with a capital letter" do
133
133
  it "should raise an Ohai::Exceptions::InvalidPluginName exception" do
134
- expect{ Ohai.plugin(:badName) { } }.to raise_error(Ohai::Exceptions::InvalidPluginName, /badName is not a valid plugin name/)
134
+ expect { Ohai.plugin(:badName) {} }.to raise_error(Ohai::Exceptions::InvalidPluginName, /badName is not a valid plugin name/)
135
135
  end
136
136
  end
137
137
 
138
138
  context "because the plugin name contains an underscore" do
139
139
  it "should raise an Ohai::Exceptions::InvalidPluginName exception" do
140
- expect{ Ohai.plugin(:Bad_Name) { } }.to raise_error(Ohai::Exceptions::InvalidPluginName, /Bad_Name is not a valid plugin name/)
140
+ expect { Ohai.plugin(:Bad_Name) {} }.to raise_error(Ohai::Exceptions::InvalidPluginName, /Bad_Name is not a valid plugin name/)
141
141
  end
142
142
  end
143
143
 
144
144
  context "because the plugin name isn't a symbol" do
145
145
  it "should raise an Ohai::Exceptions::InvalidPluginName exception" do
146
- expect{ Ohai.plugin(1138) { } }.to raise_error(Ohai::Exceptions::InvalidPluginName, /1138 is not a valid plugin name/)
146
+ expect { Ohai.plugin(1138) {} }.to raise_error(Ohai::Exceptions::InvalidPluginName, /1138 is not a valid plugin name/)
147
147
  end
148
148
  end
149
149
  end
150
150
 
151
151
  describe "#version" do
152
152
  it "should save the plugin version as :version7" do
153
- plugin = Ohai.plugin(:Test) { }
153
+ plugin = Ohai.plugin(:Test) {}
154
154
  expect(plugin.version).to eql(:version7)
155
155
  end
156
156
  end
@@ -163,7 +163,7 @@ describe Ohai::DSL::Plugin::VersionVII do
163
163
 
164
164
  it "should collect a list of attributes" do
165
165
  plugin = Ohai.plugin(:Test) { provides("one", "two", "three") }
166
- expect(plugin.provides_attrs).to eql(["one", "two", "three"])
166
+ expect(plugin.provides_attrs).to eql(%w{one two three})
167
167
  end
168
168
 
169
169
  it "should collect from multiple provides statements" do
@@ -172,19 +172,19 @@ describe Ohai::DSL::Plugin::VersionVII do
172
172
  provides("two", "three")
173
173
  provides("four")
174
174
  }
175
- expect(plugin.provides_attrs).to eql(["one", "two", "three", "four"])
175
+ expect(plugin.provides_attrs).to eql(%w{one two three four})
176
176
  end
177
177
 
178
178
  it "should collect attributes across multiple plugin files" do
179
179
  plugin = Ohai.plugin(:Test) { provides("one") }
180
180
  plugin = Ohai.plugin(:Test) { provides("two", "three") }
181
- expect(plugin.provides_attrs).to eql(["one", "two", "three"])
181
+ expect(plugin.provides_attrs).to eql(%w{one two three})
182
182
  end
183
183
 
184
184
  it "should collect unique attributes" do
185
185
  plugin = Ohai.plugin(:Test) { provides("one") }
186
186
  plugin = Ohai.plugin(:Test) { provides("one", "two") }
187
- expect(plugin.provides_attrs).to eql(["one", "two"])
187
+ expect(plugin.provides_attrs).to eql(%w{one two})
188
188
  end
189
189
  end
190
190
 
@@ -196,7 +196,7 @@ describe Ohai::DSL::Plugin::VersionVII do
196
196
 
197
197
  it "should collect a list of dependencies" do
198
198
  plugin = Ohai.plugin(:Test) { depends("one", "two", "three") }
199
- expect(plugin.depends_attrs).to eql(["one", "two", "three"])
199
+ expect(plugin.depends_attrs).to eql(%w{one two three})
200
200
  end
201
201
 
202
202
  it "should collect from multiple depends statements" do
@@ -205,35 +205,35 @@ describe Ohai::DSL::Plugin::VersionVII do
205
205
  depends("two", "three")
206
206
  depends("four")
207
207
  }
208
- expect(plugin.depends_attrs).to eql(["one", "two", "three", "four"])
208
+ expect(plugin.depends_attrs).to eql(%w{one two three four})
209
209
  end
210
210
 
211
211
  it "should collect dependencies across multiple plugin files" do
212
212
  plugin = Ohai.plugin(:Test) { depends("one") }
213
213
  plugin = Ohai.plugin(:Test) { depends("two", "three") }
214
- expect(plugin.depends_attrs).to eql(["one", "two", "three"])
214
+ expect(plugin.depends_attrs).to eql(%w{one two three})
215
215
  end
216
216
 
217
217
  it "should collect unique attributes" do
218
218
  plugin = Ohai.plugin(:Test) { depends("one") }
219
219
  plugin = Ohai.plugin(:Test) { depends("one", "two") }
220
- expect(plugin.depends_attrs).to eql(["one", "two"])
220
+ expect(plugin.depends_attrs).to eql(%w{one two})
221
221
  end
222
222
  end
223
223
 
224
224
  describe "#collect_data" do
225
225
  it "should save as :default if no platform is given" do
226
- plugin = Ohai.plugin(:Test) { collect_data { } }
226
+ plugin = Ohai.plugin(:Test) { collect_data {} }
227
227
  expect(plugin.data_collector).to have_key(:default)
228
228
  end
229
229
 
230
230
  it "should save a single given platform" do
231
- plugin = Ohai.plugin(:Test) { collect_data(:ubuntu) { } }
231
+ plugin = Ohai.plugin(:Test) { collect_data(:ubuntu) {} }
232
232
  expect(plugin.data_collector).to have_key(:ubuntu)
233
233
  end
234
234
 
235
235
  it "should save a list of platforms" do
236
- plugin = Ohai.plugin(:Test) { collect_data(:freebsd, :netbsd, :openbsd) { } }
236
+ plugin = Ohai.plugin(:Test) { collect_data(:freebsd, :netbsd, :openbsd) {} }
237
237
  [:freebsd, :netbsd, :openbsd].each do |platform|
238
238
  expect(plugin.data_collector).to have_key(platform)
239
239
  end
@@ -241,9 +241,9 @@ describe Ohai::DSL::Plugin::VersionVII do
241
241
 
242
242
  it "should save multiple collect_data blocks" do
243
243
  plugin = Ohai.plugin(:Test) {
244
- collect_data { }
245
- collect_data(:windows) { }
246
- collect_data(:darwin) { }
244
+ collect_data {}
245
+ collect_data(:windows) {}
246
+ collect_data(:darwin) {}
247
247
  }
248
248
  [:darwin, :default, :windows].each do |platform|
249
249
  expect(plugin.data_collector).to have_key(platform)
@@ -251,8 +251,8 @@ describe Ohai::DSL::Plugin::VersionVII do
251
251
  end
252
252
 
253
253
  it "should save platforms across multiple plugins" do
254
- plugin = Ohai.plugin(:Test) { collect_data { } }
255
- plugin = Ohai.plugin(:Test) { collect_data(:aix, :sigar) { } }
254
+ plugin = Ohai.plugin(:Test) { collect_data {} }
255
+ plugin = Ohai.plugin(:Test) { collect_data(:aix, :sigar) {} }
256
256
  [:aix, :default, :sigar].each do |platform|
257
257
  expect(plugin.data_collector).to have_key(platform)
258
258
  end
@@ -261,17 +261,17 @@ describe Ohai::DSL::Plugin::VersionVII do
261
261
  it "should fail a platform has already been defined in the same plugin" do
262
262
  expect {
263
263
  Ohai.plugin(:Test) {
264
- collect_data { }
265
- collect_data { }
264
+ collect_data {}
265
+ collect_data {}
266
266
  }
267
267
  }.to raise_error(Ohai::Exceptions::IllegalPluginDefinition, /collect_data already defined/)
268
268
  end
269
269
 
270
270
  it "should fail if a platform has already been defined in another plugin file" do
271
- Ohai.plugin(:Test) { collect_data { } }
271
+ Ohai.plugin(:Test) { collect_data {} }
272
272
  expect {
273
273
  Ohai.plugin(:Test) {
274
- collect_data { }
274
+ collect_data {}
275
275
  }
276
276
  }.to raise_error(Ohai::Exceptions::IllegalPluginDefinition, /collect_data already defined/)
277
277
  end
@@ -295,7 +295,7 @@ describe Ohai::DSL::Plugin::VersionVII do
295
295
 
296
296
  describe "#configuration" do
297
297
  let(:plugin) do
298
- klass = Ohai.plugin(camel_name) { }
298
+ klass = Ohai.plugin(camel_name) {}
299
299
  klass.new({})
300
300
  end
301
301
 
@@ -325,7 +325,7 @@ describe Ohai::DSL::Plugin::VersionVII do
325
325
  end
326
326
 
327
327
  it "returns nil when the suboption is not configured" do
328
- Ohai.config[:plugin][snake_name][:foo] = { }
328
+ Ohai.config[:plugin][snake_name][:foo] = {}
329
329
  expect(plugin.configuration(:foo, :bar)).to eq(nil)
330
330
  end
331
331
 
@@ -376,7 +376,7 @@ end
376
376
  describe Ohai::DSL::Plugin::VersionVI do
377
377
  describe "#version" do
378
378
  it "should save the plugin version as :version6" do
379
- plugin = Class.new(Ohai::DSL::Plugin::VersionVI) { }
379
+ plugin = Class.new(Ohai::DSL::Plugin::VersionVI) {}
380
380
  expect(plugin.version).to eql(:version6)
381
381
  end
382
382
  end
@@ -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 File.expand_path(File.dirname(__FILE__) + "/../spec_helper.rb")
21
21
 
22
22
  describe "Ohai::Hints" do
23
23
  # We are using the plugins directory infrastructure to test hints
@@ -54,11 +54,11 @@ EOF
54
54
  end
55
55
 
56
56
  it "hint? should return the data for full hints" do
57
- expect(Ohai::Hints.hint?("cloud")).to eq({"name" => "circus"})
57
+ expect(Ohai::Hints.hint?("cloud")).to eq({ "name" => "circus" })
58
58
  end
59
59
 
60
60
  it "hint? should return empty hash for empty hints" do
61
- expect(Ohai::Hints.hint?("cloud_empty")).to eq({ })
61
+ expect(Ohai::Hints.hint?("cloud_empty")).to eq({})
62
62
  end
63
63
  end
64
64
 
@@ -17,13 +17,13 @@
17
17
  # limitations under the License.
18
18
  #
19
19
 
20
- require File.expand_path(File.dirname(__FILE__) + '/../spec_helper.rb')
20
+ require File.expand_path(File.dirname(__FILE__) + "/../spec_helper.rb")
21
21
 
22
22
  describe Ohai::Loader do
23
23
  extend IntegrationSupport
24
24
 
25
25
  let(:loader) { Ohai::Loader.new(ohai) }
26
- let(:ohai) { double('Ohai::System', :data => Mash.new, :provides_map => provides_map) }
26
+ let(:ohai) { double("Ohai::System", :data => Mash.new, :provides_map => provides_map) }
27
27
  let(:provides_map) { Ohai::ProvidesMap.new }
28
28
 
29
29
  describe "#initialize" do
@@ -150,7 +150,7 @@ EOF
150
150
  end
151
151
 
152
152
  it "does not raise an error" do
153
- expect{ loader.load_plugin(path_to("extra_s.rb")) }.not_to raise_error
153
+ expect { loader.load_plugin(path_to("extra_s.rb")) }.not_to raise_error
154
154
  end
155
155
  end
156
156
 
@@ -161,7 +161,7 @@ EOF
161
161
  end
162
162
 
163
163
  it "does not raise an error" do
164
- expect{ loader.load_plugin(path_to("no_method.rb")) }.not_to raise_error
164
+ expect { loader.load_plugin(path_to("no_method.rb")) }.not_to raise_error
165
165
  end
166
166
  end
167
167
 
@@ -172,7 +172,7 @@ EOF
172
172
  end
173
173
 
174
174
  it "does not raise an error" do
175
- expect{ loader.load_plugin(path_to("illegal_def.rb")) }.not_to raise_error
175
+ expect { loader.load_plugin(path_to("illegal_def.rb")) }.not_to raise_error
176
176
  end
177
177
  end
178
178
 
@@ -183,7 +183,7 @@ EOF
183
183
  end
184
184
 
185
185
  it "does not raise an error" do
186
- expect{ loader.load_plugin(path_to("unexpected_error.rb")) }.not_to raise_error
186
+ expect { loader.load_plugin(path_to("unexpected_error.rb")) }.not_to raise_error
187
187
  end
188
188
  end
189
189
 
@@ -194,7 +194,7 @@ EOF
194
194
  end
195
195
 
196
196
  it "does not raise an error" do
197
- expect{ loader.load_plugin(path_to("bad_symbol.rb")) }.not_to raise_error
197
+ expect { loader.load_plugin(path_to("bad_symbol.rb")) }.not_to raise_error
198
198
  end
199
199
  end
200
200
 
@@ -205,7 +205,7 @@ EOF
205
205
  end
206
206
 
207
207
  it "does not raise an error" do
208
- expect{ loader.load_plugin(path_to("no_end.rb")) }.not_to raise_error
208
+ expect { loader.load_plugin(path_to("no_end.rb")) }.not_to raise_error
209
209
  end
210
210
  end
211
211
 
@@ -216,7 +216,7 @@ EOF
216
216
  end
217
217
 
218
218
  it "does not raise an error" do
219
- expect{ loader.load_plugin(path_to("bad_name.rb")) }.not_to raise_error
219
+ expect { loader.load_plugin(path_to("bad_name.rb")) }.not_to raise_error
220
220
  end
221
221
  end
222
222
  end