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
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: df97b8b25c82b3afc5230e4be648989481aa4082
4
- data.tar.gz: b6814cfa34071bd5e11bee94c417c0e57035c32e
3
+ metadata.gz: f773eb5ea1a32204f9cf602455776492dded72e5
4
+ data.tar.gz: 9a49d6bba8ea5058935e8a7f12d4ad204db71168
5
5
  SHA512:
6
- metadata.gz: aa2aa6235d8baf1371e4a40c6fb3b7d2e238a6d3da7a460cb312519ed24d4a8edd9d9188b0f02b9c77e47bcc838583fffe2422aba57663750b4003c8945386ea
7
- data.tar.gz: 8578b6b564b23aef84eea2efcc356df71f4a410ae212a25ee213542eab8ce63c4f82a026741c2f78cef647729e405289f71ac641df52f30f7cd9c3d68bc04364
6
+ metadata.gz: 102f27a1df33f5049c3ca49ed6d4944281b65a2702cdbc11fd7dc2d62fb4fd185359581db7380936ec1d86bc04ca0224bdd6cd237f01695653ba3130b815d284
7
+ data.tar.gz: 148e626698de7337b8ebaf79b882786ead5a6d7ef04b71d475047c016874952a3f1d5bcae5ea97a2361d3bd354056f99a55833434b29d5d391c115075054320c
data/Gemfile CHANGED
@@ -6,9 +6,8 @@ group :development do
6
6
  gem "chef", github: "chef/chef", branch: "master"
7
7
 
8
8
  gem "sigar", :platform => "ruby"
9
- gem 'plist'
10
9
 
11
- gem "chefstyle", "= 0.1.0"
10
+ gem "chefstyle", "= 0.3.0"
12
11
  # gem 'pry-byebug'
13
12
  # gem 'pry-stack_explorer'
14
13
  end
data/Rakefile CHANGED
@@ -1,12 +1,12 @@
1
1
  require "bundler/gem_tasks"
2
- require 'date'
3
- require 'ohai/version'
2
+ require "date"
3
+ require "ohai/version"
4
4
 
5
5
  begin
6
- require 'rspec/core/rake_task'
6
+ require "rspec/core/rake_task"
7
7
 
8
8
  RSpec::Core::RakeTask.new do |t|
9
- t.pattern = 'spec/**/*_spec.rb'
9
+ t.pattern = "spec/**/*_spec.rb"
10
10
  end
11
11
  rescue LoadError
12
12
  desc "rspec is not installed, this task is disabled"
@@ -22,3 +22,12 @@ require "rubocop/rake_task"
22
22
  RuboCop::RakeTask.new(:style) do |task|
23
23
  task.options += ["--display-cop-names", "--no-color"]
24
24
  end
25
+
26
+ require "github_changelog_generator/task"
27
+
28
+ GitHubChangelogGenerator::RakeTask.new :changelog do |config|
29
+ config.future_release = Ohai::VERSION
30
+ config.enhancement_labels = "enhancement,Enhancement,New Feature,Feature".split(",")
31
+ config.bug_labels = "bug,Bug,Improvement,Upstream Bug".split(",")
32
+ config.exclude_labels = "duplicate,question,invalid,wontfix,no_changelog,Exclude From Changelog,Question,Discussion".split(",")
33
+ end
data/bin/ohai CHANGED
@@ -19,9 +19,8 @@
19
19
  # limitations under the License.
20
20
  #
21
21
 
22
-
23
22
  begin
24
- require 'rubygems'
23
+ require "rubygems"
25
24
  rescue LoadError
26
25
  # must be debian! ;)
27
26
  missing_rubygems = true
@@ -29,8 +28,8 @@ end
29
28
  begin
30
29
  # if we're in a source code checkout, we want to run the code from that.
31
30
  # have to do this *after* rubygems is loaded.
32
- $:.unshift File.expand_path('../../lib', __FILE__)
33
- require 'ohai/application'
31
+ $:.unshift File.expand_path("../../lib", __FILE__)
32
+ require "ohai/application"
34
33
  rescue LoadError
35
34
  if missing_rubygems
36
35
  STDERR.puts "rubygems previously failed to load - is it installed?"
@@ -16,7 +16,7 @@
16
16
  # limitations under the License.
17
17
  #
18
18
 
19
- require 'ohai/version'
20
- require 'ohai/config'
21
- require 'ohai/system'
22
- require 'ohai/exception'
19
+ require "ohai/version"
20
+ require "ohai/config"
21
+ require "ohai/system"
22
+ require "ohai/exception"
@@ -15,11 +15,11 @@
15
15
  # See the License for the specific language governing permissions and
16
16
  # limitations under the License.
17
17
 
18
- require 'chef-config/path_helper'
19
- require 'chef-config/workstation_config_loader'
20
- require 'ohai'
21
- require 'ohai/log'
22
- require 'mixlib/cli'
18
+ require "chef-config/path_helper"
19
+ require "chef-config/workstation_config_loader"
20
+ require "ohai"
21
+ require "ohai/log"
22
+ require "mixlib/cli"
23
23
 
24
24
  class Ohai::Application
25
25
  include Mixlib::CLI
@@ -62,7 +62,7 @@ class Ohai::Application
62
62
  :long => "--version",
63
63
  :description => "Show Ohai version",
64
64
  :boolean => true,
65
- :proc => lambda {|v| puts "Ohai: #{::Ohai::VERSION}"},
65
+ :proc => lambda { |v| puts "Ohai: #{::Ohai::VERSION}" },
66
66
  :exit => 0
67
67
 
68
68
  def initialize
@@ -113,6 +113,7 @@ class Ohai::Application
113
113
  end
114
114
 
115
115
  private
116
+
116
117
  def load_workstation_config
117
118
  config_loader = ChefConfig::WorkstationConfigLoader.new(
118
119
  config[:config_file], Ohai::Log
@@ -6,9 +6,9 @@
6
6
  # Licensed under the Apache License, Version 2.0 (the "License");
7
7
  # you may not use this file except in compliance with the License.
8
8
  # You may obtain a copy of the License at
9
- #
9
+ #
10
10
  # http://www.apache.org/licenses/LICENSE-2.0
11
- #
11
+ #
12
12
  # Unless required by applicable law or agreed to in writing, software
13
13
  # distributed under the License is distributed on an "AS IS" BASIS,
14
14
  # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -25,48 +25,48 @@ module Ohai
25
25
  # 128-255 are 'oem_data_[id]'
26
26
  # Everything else is 'unknown'
27
27
  IdToDescription = {
28
- 0 => 'bios',
29
- 1 => 'system',
30
- 2 => 'base_board',
31
- 3 => 'chassis',
32
- 4 => 'processor',
33
- 5 => 'memory_controller',
34
- 6 => 'memory_module',
35
- 7 => 'cache',
36
- 8 => 'port_connector',
37
- 9 => 'system_slots',
38
- 10 => 'on_board_devices',
39
- 11 => 'oem_strings',
40
- 12 => 'system_configuration_options',
41
- 13 => 'bios_language',
42
- 14 => 'group_associations',
43
- 15 => 'system_event_log',
44
- 16 => 'physical_memory_array',
45
- 17 => 'memory_device',
46
- 18 => '32_bit_memory_error',
47
- 19 => 'memory_array_mapped_address',
48
- 20 => 'memory_device_mapped_address',
49
- 21 => 'built_in_pointing_device',
50
- 22 => 'portable_battery',
51
- 23 => 'system_reset',
52
- 24 => 'hardware_security',
53
- 25 => 'system_power_controls',
54
- 26 => 'voltage_probe',
55
- 27 => 'cooling_device',
56
- 28 => 'temperature_probe',
57
- 29 => 'electrical_current_probe',
58
- 30 => 'out_of_band_remote_access',
59
- 31 => 'boot_integrity_services',
60
- 32 => 'system_boot',
61
- 33 => '64_bit_memory_error',
62
- 34 => 'management_device',
63
- 35 => 'management_device_component',
64
- 36 => 'management_device_threshold_data',
65
- 37 => 'memory_channel',
66
- 38 => 'ipmi_device',
67
- 39 => 'power_supply',
68
- 126 => 'disabled_entries',
69
- 127 => 'end_of_table_marker',
28
+ 0 => "bios",
29
+ 1 => "system",
30
+ 2 => "base_board",
31
+ 3 => "chassis",
32
+ 4 => "processor",
33
+ 5 => "memory_controller",
34
+ 6 => "memory_module",
35
+ 7 => "cache",
36
+ 8 => "port_connector",
37
+ 9 => "system_slots",
38
+ 10 => "on_board_devices",
39
+ 11 => "oem_strings",
40
+ 12 => "system_configuration_options",
41
+ 13 => "bios_language",
42
+ 14 => "group_associations",
43
+ 15 => "system_event_log",
44
+ 16 => "physical_memory_array",
45
+ 17 => "memory_device",
46
+ 18 => "32_bit_memory_error",
47
+ 19 => "memory_array_mapped_address",
48
+ 20 => "memory_device_mapped_address",
49
+ 21 => "built_in_pointing_device",
50
+ 22 => "portable_battery",
51
+ 23 => "system_reset",
52
+ 24 => "hardware_security",
53
+ 25 => "system_power_controls",
54
+ 26 => "voltage_probe",
55
+ 27 => "cooling_device",
56
+ 28 => "temperature_probe",
57
+ 29 => "electrical_current_probe",
58
+ 30 => "out_of_band_remote_access",
59
+ 31 => "boot_integrity_services",
60
+ 32 => "system_boot",
61
+ 33 => "64_bit_memory_error",
62
+ 34 => "management_device",
63
+ 35 => "management_device_component",
64
+ 36 => "management_device_threshold_data",
65
+ 37 => "memory_channel",
66
+ 38 => "ipmi_device",
67
+ 39 => "power_supply",
68
+ 126 => "disabled_entries",
69
+ 127 => "end_of_table_marker",
70
70
  }
71
71
 
72
72
  # list of IDs to collect, otherwise we generate pages of hashes about cache chip size and whatnot
@@ -83,7 +83,7 @@ module Ohai
83
83
  id = DMI::IdToDescription[id]
84
84
  else
85
85
  Ohai::Log.debug("unrecognized header id; falling back to 'unknown'")
86
- id = 'unknown'
86
+ id = "unknown"
87
87
  end
88
88
  rescue
89
89
  Ohai::Log.debug("failed to look up id #{id}, returning unchanged")
@@ -95,17 +95,17 @@ module Ohai
95
95
  # for single occurrences of one type, copy to top level all fields and values
96
96
  # for multiple occurrences of same type, copy to top level all fields and values that are common to all records
97
97
  def convenience_keys(dmi)
98
- dmi.each{ |type, records|
98
+ dmi.each { |type, records|
99
99
  in_common = Mash.new
100
- next unless records.class.to_s == 'Mash'
101
- next unless records.has_key?('all_records')
102
- records[:all_records].each{ |record|
103
- record.each{ |field, value|
104
- next if value.class.to_s == 'Mash'
105
- next if field.to_s == 'application_identifier'
106
- next if field.to_s == 'size'
107
- next if field.to_s == 'record_id'
108
- translated = field.downcase.gsub(/[^a-z0-9]/, '_')
100
+ next unless records.class.to_s == "Mash"
101
+ next unless records.has_key?("all_records")
102
+ records[:all_records].each { |record|
103
+ record.each { |field, value|
104
+ next if value.class.to_s == "Mash"
105
+ next if field.to_s == "application_identifier"
106
+ next if field.to_s == "size"
107
+ next if field.to_s == "record_id"
108
+ translated = field.downcase.gsub(/[^a-z0-9]/, "_")
109
109
  value = value.strip
110
110
  if in_common.has_key?(translated)
111
111
  in_common[translated] = nil unless in_common[translated] == value
@@ -114,7 +114,7 @@ module Ohai
114
114
  end
115
115
  }
116
116
  }
117
- in_common.each{ |field, value|
117
+ in_common.each { |field, value|
118
118
  next if value == nil
119
119
  dmi[type][field] = value.strip
120
120
  }
@@ -17,10 +17,10 @@
17
17
  # limitations under the License.
18
18
  #
19
19
 
20
- require 'chef-config/config'
21
- require 'ohai/exception'
22
- require 'ohai/log'
23
- require 'ohai/plugin_config'
20
+ require "chef-config/config"
21
+ require "ohai/exception"
22
+ require "ohai/log"
23
+ require "ohai/plugin_config"
24
24
 
25
25
  module Ohai
26
26
  Config = ChefConfig::Config
@@ -30,16 +30,19 @@ module Ohai
30
30
  class Config
31
31
  # These methods need to be defined before they are used as config defaults,
32
32
  # otherwise they will get method_missing'd to nil.
33
+
33
34
  private
35
+
34
36
  def self.default_hints_path
35
- [ ChefConfig::Config.platform_specific_path('/etc/chef/ohai/hints') ]
37
+ [ ChefConfig::Config.platform_specific_path("/etc/chef/ohai/hints") ]
36
38
  end
37
39
 
38
40
  def self.default_plugin_path
39
- [ File.expand_path(File.join(File.dirname(__FILE__), 'plugins')) ]
41
+ [ File.expand_path(File.join(File.dirname(__FILE__), "plugins")) ]
40
42
  end
41
43
 
42
44
  public
45
+
43
46
  # Copy deprecated configuration options into the ohai config context.
44
47
  def self.merge_deprecated_config
45
48
  [ :hints_path, :plugin_path ].each do |option|
@@ -68,7 +71,7 @@ module Ohai
68
71
  :disabled_plugins,
69
72
  :log_level,
70
73
  :log_location,
71
- :version
74
+ :version,
72
75
  ].each do |option|
73
76
  # https://docs.chef.io/config_rb_client.html#ohai-settings
74
77
  # hints_path and plugin_path are intentionally excluded here; warnings for
@@ -100,6 +103,7 @@ module Ohai
100
103
  end
101
104
 
102
105
  private
106
+
103
107
  def self.option_deprecated(option)
104
108
  <<-EOM.chomp!.gsub("\n", " ")
105
109
  Ohai::Config[:#{option}] is set. Ohai::Config[:#{option}] is deprecated and will
@@ -119,6 +123,6 @@ EOM
119
123
 
120
124
  # Shortcut for Ohai::Config.ohai
121
125
  def self.config
122
- Config::ohai
126
+ Config.ohai
123
127
  end
124
128
  end
@@ -17,6 +17,6 @@
17
17
  # limitations under the License.
18
18
  #
19
19
 
20
- require 'ohai/dsl/plugin'
21
- require 'ohai/dsl/plugin/versionvi'
22
- require 'ohai/dsl/plugin/versionvii'
20
+ require "ohai/dsl/plugin"
21
+ require "ohai/dsl/plugin/versionvi"
22
+ require "ohai/dsl/plugin/versionvii"
@@ -18,10 +18,10 @@
18
18
  # limitations under the License.
19
19
  #
20
20
 
21
- require 'ohai/mixin/os'
22
- require 'ohai/mixin/command'
23
- require 'ohai/mixin/seconds_to_human'
24
- require 'ohai/hints'
21
+ require "ohai/mixin/os"
22
+ require "ohai/mixin/command"
23
+ require "ohai/mixin/seconds_to_human"
24
+ require "ohai/hints"
25
25
 
26
26
  module Ohai
27
27
 
@@ -171,7 +171,7 @@ module Ohai
171
171
  raise e
172
172
  rescue => e
173
173
  Ohai::Log.debug("Plugin #{self.name} threw #{e.inspect}")
174
- e.backtrace.each { |line| Ohai::Log.debug( line )}
174
+ e.backtrace.each { |line| Ohai::Log.debug( line ) }
175
175
  end
176
176
  end
177
177
 
@@ -59,4 +59,3 @@ module Ohai
59
59
  end
60
60
  end
61
61
  end
62
-
@@ -112,6 +112,7 @@ module Ohai
112
112
  end
113
113
 
114
114
  private
115
+
115
116
  def plugin_config
116
117
  @plugin_config ||= fetch_plugin_config
117
118
  end
@@ -17,7 +17,7 @@
17
17
  # limitations under the License.
18
18
  #
19
19
 
20
- require 'ffi_yajl'
20
+ require "ffi_yajl"
21
21
 
22
22
  module Ohai
23
23
  module Hints
@@ -16,11 +16,11 @@
16
16
  # limitations under the License.
17
17
  #
18
18
 
19
- require 'chef-config/path_helper'
20
- require 'ohai/log'
21
- require 'ohai/mash'
22
- require 'ohai/dsl'
23
- require 'pathname'
19
+ require "chef-config/path_helper"
20
+ require "ohai/log"
21
+ require "ohai/mash"
22
+ require "ohai/dsl"
23
+ require "pathname"
24
24
 
25
25
  module Ohai
26
26
 
@@ -39,7 +39,7 @@ module Ohai
39
39
 
40
40
  # Finds all the *.rb files under the configured paths in :plugin_path
41
41
  def self.find_all_in(plugin_dir)
42
- Dir[File.join(ChefConfig::PathHelper.escape_glob(plugin_dir), "**", "*.rb")].map do |file|
42
+ Dir[File.join(ChefConfig::PathHelper.escape_glob_dir(plugin_dir), "**", "*.rb")].map do |file|
43
43
  new(file, plugin_dir)
44
44
  end
45
45
  end
@@ -95,7 +95,7 @@ module Ohai
95
95
  # If `plugin_dir_path` is given, and the file at `plugin_path` is a v6
96
96
  # plugin, the 'relative path' of the plugin (used by `require_plugin()`) is
97
97
  # computed by finding the relative path from `plugin_dir_path` to `plugin_path`
98
- def load_plugin_class(plugin_path, plugin_dir_path=nil)
98
+ def load_plugin_class(plugin_path, plugin_dir_path = nil)
99
99
  # Read the contents of the plugin to understand if it's a V6 or V7 plugin.
100
100
  contents = ""
101
101
  begin
@@ -16,7 +16,7 @@
16
16
  # limitations under the License.
17
17
  #
18
18
 
19
- require 'mixlib/log'
19
+ require "mixlib/log"
20
20
 
21
21
  module Ohai
22
22
  class Log
@@ -128,7 +128,7 @@ class Mash < Hash
128
128
  #
129
129
  # @return [Array] The values at each of the provided keys
130
130
  def values_at(*indices)
131
- indices.collect {|key| self[convert_key(key)]}
131
+ indices.collect { |key| self[convert_key(key)] }
132
132
  end
133
133
 
134
134
  # @param hash<Hash> The hash to merge with the mash.
@@ -152,7 +152,7 @@ class Mash < Hash
152
152
  # { :one => 1, :two => 2, :three => 3 }.except(:one)
153
153
  # #=> { "two" => 2, "three" => 3 }
154
154
  def except(*keys)
155
- super(*keys.map {|k| convert_key(k)})
155
+ super(*keys.map { |k| convert_key(k) })
156
156
  end
157
157
 
158
158
  # Used to provide the same interface as Hash.
@@ -181,6 +181,7 @@ class Mash < Hash
181
181
  end
182
182
 
183
183
  protected
184
+
184
185
  # @param key<Object> The key to convert.
185
186
  #
186
187
  # @param [Object]