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
@@ -16,10 +16,9 @@
16
16
  # limitations under the License.
17
17
  #
18
18
 
19
+ require File.expand_path(File.dirname(__FILE__) + "/../../spec_helper.rb")
19
20
 
20
- require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper.rb')
21
-
22
- ruby_bin = File.join(::RbConfig::CONFIG['bindir'], ::RbConfig::CONFIG['ruby_install_name'])
21
+ ruby_bin = File.join(::RbConfig::CONFIG["bindir"], ::RbConfig::CONFIG["ruby_install_name"])
23
22
 
24
23
  describe Ohai::System, "plugin ruby" do
25
24
 
@@ -39,18 +38,18 @@ describe Ohai::System, "plugin ruby" do
39
38
  :platform => RUBY_PLATFORM,
40
39
  :version => RUBY_VERSION,
41
40
  :release_date => RUBY_RELEASE_DATE,
42
- :target => ::RbConfig::CONFIG['target'],
43
- :target_cpu => ::RbConfig::CONFIG['target_cpu'],
44
- :target_vendor => ::RbConfig::CONFIG['target_vendor'],
45
- :target_os => ::RbConfig::CONFIG['target_os'],
46
- :host => ::RbConfig::CONFIG['host'],
47
- :host_cpu => ::RbConfig::CONFIG['host_cpu'],
48
- :host_os => ::RbConfig::CONFIG['host_os'],
49
- :host_vendor => ::RbConfig::CONFIG['host_vendor'],
50
- :gems_dir => %x{#{ruby_bin} #{::RbConfig::CONFIG['bindir']}/gem env gemdir}.chomp,
51
- :gem_bin => [ ::Gem.default_exec_format % 'gem', 'gem' ].map{|bin| "#{::RbConfig::CONFIG['bindir']}/#{bin}"
52
- }.find{|bin| ::File.exists? bin},
53
- :ruby_bin => ruby_bin
41
+ :target => ::RbConfig::CONFIG["target"],
42
+ :target_cpu => ::RbConfig::CONFIG["target_cpu"],
43
+ :target_vendor => ::RbConfig::CONFIG["target_vendor"],
44
+ :target_os => ::RbConfig::CONFIG["target_os"],
45
+ :host => ::RbConfig::CONFIG["host"],
46
+ :host_cpu => ::RbConfig::CONFIG["host_cpu"],
47
+ :host_os => ::RbConfig::CONFIG["host_os"],
48
+ :host_vendor => ::RbConfig::CONFIG["host_vendor"],
49
+ :gems_dir => `#{ruby_bin} #{::RbConfig::CONFIG["bindir"]}/gem env gemdir`.chomp,
50
+ :gem_bin => [ ::Gem.default_exec_format % "gem", "gem" ].map {|bin| "#{::RbConfig::CONFIG['bindir']}/#{bin}"
51
+ }.find { |bin| ::File.exists? bin },
52
+ :ruby_bin => ruby_bin,
54
53
  }.each do |attribute, value|
55
54
  it "should have #{attribute} set to #{value.inspect}" do
56
55
  expect(@ruby_ohai_data[attribute]).to eql(value)
@@ -14,10 +14,10 @@
14
14
  # limitations under the License.
15
15
  #
16
16
 
17
- require File.expand_path(File.join(File.dirname(__FILE__), '..', '..', '/spec_helper.rb'))
17
+ require File.expand_path(File.join(File.dirname(__FILE__), "..", "..", "/spec_helper.rb"))
18
18
 
19
19
  describe Ohai::System, "plugin rust" do
20
- let(:stdout) {"rustc 1.0.0-nightly (29bd9a06e 2015-01-20 23:03:09 +0000)"}
20
+ let(:stdout) { "rustc 1.0.0-nightly (29bd9a06e 2015-01-20 23:03:09 +0000)" }
21
21
  let (:plugin) do
22
22
  plugin = get_plugin("rust")
23
23
  plugin[:languages] = Mash.new
@@ -16,16 +16,16 @@
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
  sigar_available = begin
22
- require 'sigar'
22
+ require "sigar"
23
23
  true
24
24
  rescue LoadError
25
25
  false
26
26
  end
27
27
 
28
- require 'ohai'
28
+ require "ohai"
29
29
 
30
30
  describe Ohai::System, "Sigar network route plugin" do
31
31
 
@@ -36,18 +36,18 @@ describe Ohai::System, "Sigar network route plugin" do
36
36
  @plugin = get_plugin("sigar/network", @ohai)
37
37
  allow(@plugin).to receive(:collect_os).and_return(:sigar)
38
38
  @sigar = double("Sigar")
39
- @net_info_conf={
39
+ @net_info_conf = {
40
40
  :default_gateway => "192.168.1.254",
41
41
  :default_gateway_interface => "eth0",
42
42
  :primary_dns => "192.168.1.254",
43
43
  :secondary_dns => "8.8.8.8",
44
- :host_name => "localhost"
44
+ :host_name => "localhost",
45
45
  }
46
- net_info=double("Sigar::NetInfo")
47
- @net_info_conf.each_pair do |k,v|
46
+ net_info = double("Sigar::NetInfo")
47
+ @net_info_conf.each_pair do |k, v|
48
48
  allow(net_info).to receive(k).and_return(v)
49
49
  end
50
- @net_route_conf={
50
+ @net_route_conf = {
51
51
  :destination => "192.168.1.0",
52
52
  :gateway => "0.0.0.0",
53
53
  :mask => "255.255.255.0",
@@ -58,13 +58,13 @@ describe Ohai::System, "Sigar network route plugin" do
58
58
  :mtu => 0,
59
59
  :window => 0,
60
60
  :irtt => 0,
61
- :ifname => "eth0"
61
+ :ifname => "eth0",
62
62
  }
63
- net_route=double("Sigar::NetRoute")
64
- @net_route_conf.each_pair do |k,v|
63
+ net_route = double("Sigar::NetRoute")
64
+ @net_route_conf.each_pair do |k, v|
65
65
  allow(net_route).to receive(k).and_return(v)
66
66
  end
67
- @net_interface_conf={
67
+ @net_interface_conf = {
68
68
  :flags => 2115,
69
69
  :destination => "192.168.1.1",
70
70
  :mtu => 1500,
@@ -77,39 +77,39 @@ describe Ohai::System, "Sigar network route plugin" do
77
77
  :tx_queue_len => 1000,
78
78
  :prefix6_length => 0,
79
79
  }
80
- net_conf=double("Sigar::NetConf")
81
- @net_interface_conf.each_pair do |k,v|
80
+ net_conf = double("Sigar::NetConf")
81
+ @net_interface_conf.each_pair do |k, v|
82
82
  allow(net_conf).to receive(k).and_return(v)
83
83
  end
84
- @net_interface_stat={
85
- :rx_bytes=>1369035618,
86
- :rx_dropped=>0,
87
- :rx_errors=>0,
88
- :rx_frame=>0,
89
- :rx_overruns=>0,
90
- :rx_packets=>7271669,
91
- :speed=>-1,
92
- :tx_bytes=>3482843666,
93
- :tx_carrier=>0,
94
- :tx_collisions=>0,
95
- :tx_dropped=>0,
96
- :tx_errors=>0,
97
- :tx_overruns=>0,
98
- :tx_packets=>4392794
84
+ @net_interface_stat = {
85
+ :rx_bytes => 1369035618,
86
+ :rx_dropped => 0,
87
+ :rx_errors => 0,
88
+ :rx_frame => 0,
89
+ :rx_overruns => 0,
90
+ :rx_packets => 7271669,
91
+ :speed => -1,
92
+ :tx_bytes => 3482843666,
93
+ :tx_carrier => 0,
94
+ :tx_collisions => 0,
95
+ :tx_dropped => 0,
96
+ :tx_errors => 0,
97
+ :tx_overruns => 0,
98
+ :tx_packets => 4392794,
99
99
  }
100
- net_stat=double("Sigar::NetStat")
101
- @net_interface_stat.each_pair do |k,v|
100
+ net_stat = double("Sigar::NetStat")
101
+ @net_interface_stat.each_pair do |k, v|
102
102
  allow(net_stat).to receive(k).and_return(v)
103
103
  end
104
- @net_arp_conf={
104
+ @net_arp_conf = {
105
105
  :address => "192.168.1.5",
106
106
  :flags => 2,
107
107
  :hwaddr => "00:15:62:96:01:D0",
108
108
  :ifname => "eth0",
109
109
  :type => "ether",
110
110
  }
111
- net_arp=double("Sigar::NetArp")
112
- @net_arp_conf.each_pair do |k,v|
111
+ net_arp = double("Sigar::NetArp")
112
+ @net_arp_conf.each_pair do |k, v|
113
113
  allow(net_arp).to receive(k).and_return(v)
114
114
  end
115
115
  allow(@sigar).to receive(:fqdn).and_return("localhost.localdomain")
@@ -131,10 +131,10 @@ describe Ohai::System, "Sigar network route plugin" do
131
131
  end
132
132
 
133
133
  it "should set the route details" do
134
- @net_route_conf.each_pair do |k,v|
134
+ @net_route_conf.each_pair do |k, v|
135
135
  # Work around the above doubleing of net_route_list skipping the call to flags()
136
136
  if k == :flags
137
- v="U"
137
+ v = "U"
138
138
  @plugin[:network][:interfaces][:eth0][:route]["192.168.1.0"][k] = v
139
139
  end
140
140
  expect(@plugin[:network][:interfaces][:eth0][:route]["192.168.1.0"]).to have_key(k)
@@ -17,42 +17,42 @@
17
17
  # See the License for the specific language governing permissions and
18
18
  # limitations under the License.
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
- describe Ohai::System, 'plugin softlayer' do
22
+ describe Ohai::System, "plugin softlayer" do
23
23
  let(:plugin) { get_plugin("softlayer") }
24
24
 
25
25
  it "not create softlayer if hint file doesn't exists" do
26
- allow(@plugin).to receive(:hint?).with('softlayer').and_return(false)
26
+ allow(@plugin).to receive(:hint?).with("softlayer").and_return(false)
27
27
  plugin.run
28
28
  expect(plugin[:softlayer]).to be_nil
29
29
  end
30
30
 
31
31
  it "do not create node if fetch_metadata raise an error" do
32
- allow(plugin).to receive(:hint?).with('softlayer').and_return(false)
32
+ allow(plugin).to receive(:hint?).with("softlayer").and_return(false)
33
33
  allow(plugin).to receive(:fetch_metadata).and_raise(StandardError.new("TEST"))
34
34
  plugin.run
35
35
  expect(plugin[:softlayer]).to be_nil
36
36
  end
37
37
 
38
38
  it "create empty node if fetch_metadata return empty hash" do
39
- allow(plugin).to receive(:hint?).with('softlayer').and_return(true)
39
+ allow(plugin).to receive(:hint?).with("softlayer").and_return(true)
40
40
  allow(plugin).to receive(:fetch_metadata).and_return({})
41
41
  plugin.run
42
42
  expect(plugin[:softlayer]).to eq({})
43
43
  end
44
44
 
45
45
  it "create empty node if fetch_metadata return hash with nil values" do
46
- metadata = { 'local_ipv4' => nil, 'public_ipv4' => nil, 'public_fqdn' => nil}
47
- allow(plugin).to receive(:hint?).with('softlayer').and_return(true)
46
+ metadata = { "local_ipv4" => nil, "public_ipv4" => nil, "public_fqdn" => nil }
47
+ allow(plugin).to receive(:hint?).with("softlayer").and_return(true)
48
48
  allow(plugin).to receive(:fetch_metadata).and_return(metadata)
49
49
  plugin.run
50
50
  expect(plugin[:softlayer]).to eq(metadata)
51
51
  end
52
52
 
53
- it 'populate softlayer node with required attributes' do
54
- metadata = { 'local_ipv4' => '192.168.0.1', 'public_ipv4' => '8.8.8.8', 'public_fqdn' => 'abc1234.public.com'}
55
- allow(plugin).to receive(:hint?).with('softlayer').and_return(true)
53
+ it "populate softlayer node with required attributes" do
54
+ metadata = { "local_ipv4" => "192.168.0.1", "public_ipv4" => "8.8.8.8", "public_fqdn" => "abc1234.public.com" }
55
+ allow(plugin).to receive(:hint?).with("softlayer").and_return(true)
56
56
  allow(plugin).to receive(:fetch_metadata).and_return(metadata)
57
57
  plugin.run
58
58
  expect(plugin[:softlayer]).to eq(metadata)
@@ -14,14 +14,14 @@
14
14
  # limitations under the License.
15
15
  #
16
16
 
17
- require File.expand_path(File.dirname(__FILE__) + '/../../../spec_helper.rb')
17
+ require File.expand_path(File.dirname(__FILE__) + "/../../../spec_helper.rb")
18
18
 
19
19
  describe Ohai::System, "Solaris2.X cpu plugin" do
20
20
  before(:each) do
21
21
  @plugin = get_plugin("solaris2/cpu")
22
22
  allow(@plugin).to receive(:collect_os).and_return("solaris2")
23
23
  end
24
-
24
+
25
25
  describe "on x86 processors" do
26
26
  before(:each) do
27
27
  kstatinfo_output = <<-END
@@ -91,7 +91,7 @@ cpu_info:2:cpu_info2:current_cstate 0
91
91
  cpu_info:2:cpu_info2:family 12
92
92
  cpu_info:2:cpu_info2:fpu_type i387 compatible
93
93
  cpu_info:2:cpu_info2:implementation x86 (chipid 0x1 GenuineIntel family 6 model 26 step 5 clock 2926 MHz)
94
- cpu_info:2:cpu_info2:model 93
94
+ cpu_info:2:cpu_info2:model 93
95
95
  cpu_info:2:cpu_info2:ncore_per_chip 4
96
96
  cpu_info:2:cpu_info2:ncpu_per_chip 8
97
97
  cpu_info:2:cpu_info2:pg_id 7
@@ -247,7 +247,7 @@ cpu_info:8:cpu_info8:current_cstate 1
247
247
  cpu_info:8:cpu_info8:family 12
248
248
  cpu_info:8:cpu_info8:fpu_type i387 compatible
249
249
  cpu_info:8:cpu_info8:implementation x86 (chipid 0x1 GenuineIntel family 6 model 26 step 5 clock 2926 MHz)
250
- cpu_info:8:cpu_info8:model 93
250
+ cpu_info:8:cpu_info8:model 93
251
251
  cpu_info:8:cpu_info8:ncore_per_chip 4
252
252
  cpu_info:8:cpu_info8:ncpu_per_chip 8
253
253
  cpu_info:8:cpu_info8:pg_id 1
@@ -461,14 +461,14 @@ END
461
461
  it "should get the total number of online cores" do
462
462
  expect(@plugin["cpu"]["cpustates"]["on-line"]).to eql (8)
463
463
  end
464
-
464
+
465
465
  it "should get the total number of offline cores" do
466
466
  expect(@plugin["cpu"]["cpustates"]["off-line"]).to eql (8)
467
467
  end
468
-
468
+
469
469
  describe "per-cpu information" do
470
470
  it "should include processor vendor_ids" do
471
- # CPU Socket 0
471
+ # CPU Socket 0
472
472
  expect(@plugin["cpu"]["15"]["vendor_id"]).to eql("GenuineIntel")
473
473
  expect(@plugin["cpu"]["13"]["vendor_id"]).to eql("GenuineIntel")
474
474
  expect(@plugin["cpu"]["11"]["vendor_id"]).to eql("GenuineIntel")
@@ -566,7 +566,7 @@ END
566
566
  expect(@plugin["cpu"]["4"]["stepping"]).to eql("9")
567
567
  expect(@plugin["cpu"]["2"]["stepping"]).to eql("9")
568
568
  expect(@plugin["cpu"]["0"]["stepping"]).to eql("9")
569
-
569
+
570
570
  end
571
571
 
572
572
  it "should include processor model names" do
@@ -627,8 +627,7 @@ END
627
627
  end
628
628
  end
629
629
  end
630
-
631
-
630
+
632
631
  describe "on sparc processors" do
633
632
  before(:each) do
634
633
  kstatinfo_output = <<-END
@@ -2812,7 +2811,7 @@ END
2812
2811
  allow(@plugin).to receive(:shell_out).with("kstat -p cpu_info").and_return(mock_shell_out(0, kstatinfo_output, ""))
2813
2812
  @plugin.run
2814
2813
  end
2815
-
2814
+
2816
2815
  it "should get the total virtual processor count" do
2817
2816
  expect(@plugin["cpu"]["total"]).to eql(128)
2818
2817
  end
@@ -2820,11 +2819,11 @@ END
2820
2819
  it "should get the total processor count" do
2821
2820
  expect(@plugin["cpu"]["real"]).to eql(1)
2822
2821
  end
2823
-
2822
+
2824
2823
  it "should get the total core count" do
2825
2824
  expect(@plugin["cpu"]["cores"]).to eql(16)
2826
2825
  end
2827
-
2826
+
2828
2827
  it "should get the number of threads per core" do
2829
2828
  expect(@plugin["cpu"]["corethreads"]).to eql(8)
2830
2829
  end
@@ -2832,11 +2831,11 @@ END
2832
2831
  it "should get the total number of online cores" do
2833
2832
  expect(@plugin["cpu"]["cpustates"]["on-line"]).to eql(124)
2834
2833
  end
2835
-
2834
+
2836
2835
  it "should get the total number of offline cores" do
2837
2836
  expect(@plugin["cpu"]["cpustates"]["off-line"]).to eql(4)
2838
2837
  end
2839
-
2838
+
2840
2839
  describe "per-cpu information" do
2841
2840
  it "should include processor model names" do
2842
2841
  expect(@plugin["cpu"]["0"]["model_name"]).to eql("SPARC-T3")
@@ -2890,7 +2889,7 @@ END
2890
2889
  expect(@plugin["cpu"]["120"]["core_id"]).to eql("1131")
2891
2890
  end
2892
2891
 
2893
- it "should include processor architecture" do
2892
+ it "should include processor architecture" do
2894
2893
  expect(@plugin["cpu"]["0"]["arch"]).to eql("sparcv9")
2895
2894
  expect(@plugin["cpu"]["1"]["arch"]).to eql("sparcv9")
2896
2895
  expect(@plugin["cpu"]["2"]["arch"]).to eql("sparcv9")
@@ -2899,9 +2898,9 @@ END
2899
2898
  expect(@plugin["cpu"]["125"]["arch"]).to eql("sparcv9")
2900
2899
  expect(@plugin["cpu"]["126"]["arch"]).to eql("sparcv9")
2901
2900
  expect(@plugin["cpu"]["127"]["arch"]).to eql("sparcv9")
2902
- end
2901
+ end
2903
2902
 
2904
- it "should include processor FPU type" do
2903
+ it "should include processor FPU type" do
2905
2904
  expect(@plugin["cpu"]["0"]["fpu_type"]).to eql("sparcv9")
2906
2905
  expect(@plugin["cpu"]["1"]["fpu_type"]).to eql("sparcv9")
2907
2906
  expect(@plugin["cpu"]["2"]["fpu_type"]).to eql("sparcv9")
@@ -2910,9 +2909,9 @@ END
2910
2909
  expect(@plugin["cpu"]["125"]["fpu_type"]).to eql("sparcv9")
2911
2910
  expect(@plugin["cpu"]["126"]["fpu_type"]).to eql("sparcv9")
2912
2911
  expect(@plugin["cpu"]["127"]["fpu_type"]).to eql("sparcv9")
2913
- end
2912
+ end
2914
2913
 
2915
- it "should include processor state" do
2914
+ it "should include processor state" do
2916
2915
  expect(@plugin["cpu"]["0"]["state"]).to eql("on-line")
2917
2916
  expect(@plugin["cpu"]["1"]["state"]).to eql("on-line")
2918
2917
  expect(@plugin["cpu"]["2"]["state"]).to eql("on-line")
@@ -2921,7 +2920,7 @@ END
2921
2920
  expect(@plugin["cpu"]["125"]["state"]).to eql("off-line")
2922
2921
  expect(@plugin["cpu"]["126"]["state"]).to eql("off-line")
2923
2922
  expect(@plugin["cpu"]["127"]["state"]).to eql("off-line")
2924
- end
2923
+ end
2925
2924
  end
2926
2925
  end
2927
2926
  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
  SOLARIS_DMI_OUT = <<-EOS
22
22
  ID SIZE TYPE
@@ -127,16 +127,16 @@ describe Ohai::System, "Solaris2.X DMI plugin" do
127
127
  {
128
128
  bios: {
129
129
  vendor: "American Megatrends Inc.",
130
- release_date: "08/26/2014"
130
+ release_date: "08/26/2014",
131
131
  },
132
132
  system: {
133
133
  manufacturer: "System manufacturer",
134
- product: "System Product Name"
134
+ product: "System Product Name",
135
135
  },
136
136
  chassis: {
137
137
  lock_present: "N",
138
- asset_tag: "PCS"
139
- }
138
+ asset_tag: "PCS",
139
+ },
140
140
  }.each do |id, data|
141
141
  data.each do |attribute, value|
142
142
  it "should have [:dmi][:#{id}][:#{attribute}] set" do
@@ -151,4 +151,3 @@ describe Ohai::System, "Solaris2.X DMI plugin" do
151
151
  expect(@plugin[:dmi]).not_to have_key(:on_board_devices)
152
152
  end
153
153
  end
154
-
@@ -15,7 +15,7 @@
15
15
  # limitations under the License.
16
16
  #
17
17
 
18
- require_relative '../../../spec_helper'
18
+ require_relative "../../../spec_helper"
19
19
 
20
20
  describe Ohai::System, "Solaris2.X filesystem plugin" do
21
21
  let(:plugin) { get_plugin("solaris2/filesystem") }
@@ -68,15 +68,15 @@ describe Ohai::System, "Solaris2.X filesystem plugin" do
68
68
 
69
69
  context "as a String" do
70
70
  include_examples "configured zfs properties" do
71
- let(:zfs_properties) { 'mountpoint,creation,available,used' }
72
- let(:expected_cmd) { 'mountpoint,creation,available,used' }
71
+ let(:zfs_properties) { "mountpoint,creation,available,used" }
72
+ let(:expected_cmd) { "mountpoint,creation,available,used" }
73
73
  end
74
74
  end
75
75
 
76
76
  context "as an Array" do
77
77
  include_examples "configured zfs properties" do
78
- let(:zfs_properties) { ['mountpoint', 'creation', 'available', 'used'] }
79
- let(:expected_cmd) { 'mountpoint,creation,available,used' }
78
+ let(:zfs_properties) { %w{mountpoint creation available used} }
79
+ let(:expected_cmd) { "mountpoint,creation,available,used" }
80
80
  end
81
81
  end
82
82
  end