ohai 14.2.0 → 14.3.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (130) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile +1 -1
  3. data/Rakefile +1 -1
  4. data/lib/ohai/application.rb +29 -29
  5. data/lib/ohai/common/dmi.rb +5 -5
  6. data/lib/ohai/dsl/plugin.rb +3 -3
  7. data/lib/ohai/dsl/plugin/versionvii.rb +3 -3
  8. data/lib/ohai/mixin/azure_metadata.rb +2 -2
  9. data/lib/ohai/mixin/do_metadata.rb +3 -3
  10. data/lib/ohai/mixin/ec2_metadata.rb +8 -8
  11. data/lib/ohai/mixin/gce_metadata.rb +2 -2
  12. data/lib/ohai/mixin/network_constants.rb +1 -1
  13. data/lib/ohai/mixin/scaleway_metadata.rb +3 -3
  14. data/lib/ohai/mixin/softlayer_metadata.rb +1 -1
  15. data/lib/ohai/mixin/string.rb +2 -2
  16. data/lib/ohai/plugins/aix/cpu.rb +3 -3
  17. data/lib/ohai/plugins/aix/filesystem.rb +1 -1
  18. data/lib/ohai/plugins/aix/kernel.rb +1 -1
  19. data/lib/ohai/plugins/aix/memory.rb +1 -1
  20. data/lib/ohai/plugins/aix/network.rb +3 -3
  21. data/lib/ohai/plugins/bsd/virtualization.rb +1 -1
  22. data/lib/ohai/plugins/cloud.rb +1 -1
  23. data/lib/ohai/plugins/darwin/hardware.rb +1 -1
  24. data/lib/ohai/plugins/darwin/network.rb +5 -5
  25. data/lib/ohai/plugins/darwin/platform.rb +1 -1
  26. data/lib/ohai/plugins/dmi.rb +6 -6
  27. data/lib/ohai/plugins/filesystem.rb +5 -5
  28. data/lib/ohai/plugins/hostname.rb +5 -5
  29. data/lib/ohai/plugins/kernel.rb +8 -8
  30. data/lib/ohai/plugins/linux/lspci.rb +4 -4
  31. data/lib/ohai/plugins/linux/memory.rb +4 -4
  32. data/lib/ohai/plugins/linux/network.rb +16 -16
  33. data/lib/ohai/plugins/linux/platform.rb +7 -1
  34. data/lib/ohai/plugins/netbsd/network.rb +1 -1
  35. data/lib/ohai/plugins/network.rb +5 -5
  36. data/lib/ohai/plugins/openbsd/network.rb +1 -1
  37. data/lib/ohai/plugins/packages.rb +1 -1
  38. data/lib/ohai/plugins/passwd.rb +4 -4
  39. data/lib/ohai/plugins/ruby.rb +13 -13
  40. data/lib/ohai/plugins/solaris2/dmi.rb +3 -3
  41. data/lib/ohai/plugins/solaris2/filesystem.rb +6 -6
  42. data/lib/ohai/plugins/solaris2/memory.rb +2 -2
  43. data/lib/ohai/plugins/solaris2/network.rb +36 -36
  44. data/lib/ohai/plugins/windows/network.rb +2 -2
  45. data/lib/ohai/util/win32/group_helper.rb +1 -1
  46. data/lib/ohai/version.rb +1 -1
  47. data/spec/functional/application_spec.rb +6 -6
  48. data/spec/functional/loader_spec.rb +4 -4
  49. data/spec/functional/plugins/windows/uptime_spec.rb +1 -2
  50. data/spec/spec_helper.rb +5 -5
  51. data/spec/unit/application_spec.rb +11 -11
  52. data/spec/unit/config_spec.rb +5 -5
  53. data/spec/unit/dsl/plugin_spec.rb +5 -5
  54. data/spec/unit/hints_spec.rb +2 -2
  55. data/spec/unit/loader_spec.rb +41 -41
  56. data/spec/unit/mixin/azure_metadata_spec.rb +3 -3
  57. data/spec/unit/mixin/command_spec.rb +64 -64
  58. data/spec/unit/mixin/ec2_metadata_spec.rb +6 -6
  59. data/spec/unit/mixin/softlayer_metadata_spec.rb +1 -1
  60. data/spec/unit/plugin_config_spec.rb +9 -9
  61. data/spec/unit/plugins/abort_spec.rb +6 -6
  62. data/spec/unit/plugins/aix/cpu_spec.rb +16 -16
  63. data/spec/unit/plugins/aix/filesystem_spec.rb +57 -57
  64. data/spec/unit/plugins/aix/network_spec.rb +35 -35
  65. data/spec/unit/plugins/aix/virtualization_spec.rb +210 -210
  66. data/spec/unit/plugins/azure_spec.rb +49 -49
  67. data/spec/unit/plugins/bsd/filesystem_spec.rb +13 -13
  68. data/spec/unit/plugins/bsd/virtualization_spec.rb +10 -10
  69. data/spec/unit/plugins/c_spec.rb +54 -54
  70. data/spec/unit/plugins/chef_spec.rb +3 -3
  71. data/spec/unit/plugins/darwin/cpu_spec.rb +54 -54
  72. data/spec/unit/plugins/darwin/filesystem_spec.rb +34 -34
  73. data/spec/unit/plugins/darwin/hardware_system_profiler_output.rb +1070 -1070
  74. data/spec/unit/plugins/darwin/memory_spec.rb +16 -16
  75. data/spec/unit/plugins/darwin/network_spec.rb +382 -382
  76. data/spec/unit/plugins/digital_ocean_spec.rb +7 -7
  77. data/spec/unit/plugins/dmi_spec.rb +83 -83
  78. data/spec/unit/plugins/docker_spec.rb +2 -2
  79. data/spec/unit/plugins/ec2_spec.rb +156 -156
  80. data/spec/unit/plugins/eucalyptus_spec.rb +19 -19
  81. data/spec/unit/plugins/fail_spec.rb +14 -14
  82. data/spec/unit/plugins/freebsd/cpu_spec.rb +18 -18
  83. data/spec/unit/plugins/freebsd/kernel_spec.rb +1 -1
  84. data/spec/unit/plugins/gce_spec.rb +1 -1
  85. data/spec/unit/plugins/init_package_spec.rb +1 -1
  86. data/spec/unit/plugins/java_spec.rb +4 -4
  87. data/spec/unit/plugins/joyent_spec.rb +9 -9
  88. data/spec/unit/plugins/linux/block_device_spec.rb +1 -1
  89. data/spec/unit/plugins/linux/cpu_spec.rb +155 -155
  90. data/spec/unit/plugins/linux/filesystem_spec.rb +229 -229
  91. data/spec/unit/plugins/linux/kernel_spec.rb +9 -9
  92. data/spec/unit/plugins/linux/lsb_spec.rb +18 -18
  93. data/spec/unit/plugins/linux/lspci_spec.rb +58 -58
  94. data/spec/unit/plugins/linux/mdadm_spec.rb +54 -54
  95. data/spec/unit/plugins/linux/memory_spec.rb +35 -35
  96. data/spec/unit/plugins/linux/network_spec.rb +464 -464
  97. data/spec/unit/plugins/linux/platform_spec.rb +84 -68
  98. data/spec/unit/plugins/linux/systemd_paths_spec.rb +40 -40
  99. data/spec/unit/plugins/linux/uptime_spec.rb +1 -1
  100. data/spec/unit/plugins/linux/virtualization_spec.rb +197 -197
  101. data/spec/unit/plugins/mono_spec.rb +11 -11
  102. data/spec/unit/plugins/netbsd/kernel_spec.rb +1 -1
  103. data/spec/unit/plugins/network_spec.rb +2 -2
  104. data/spec/unit/plugins/openstack_spec.rb +43 -43
  105. data/spec/unit/plugins/os_spec.rb +1 -1
  106. data/spec/unit/plugins/passwd_spec.rb +9 -9
  107. data/spec/unit/plugins/php_spec.rb +22 -22
  108. data/spec/unit/plugins/powershell_spec.rb +13 -13
  109. data/spec/unit/plugins/rackspace_spec.rb +38 -38
  110. data/spec/unit/plugins/ruby_spec.rb +14 -14
  111. data/spec/unit/plugins/scaleway_spec.rb +6 -6
  112. data/spec/unit/plugins/scsi_spec.rb +7 -7
  113. data/spec/unit/plugins/solaris2/cpu_spec.rb +2594 -2594
  114. data/spec/unit/plugins/solaris2/dmi_spec.rb +91 -91
  115. data/spec/unit/plugins/solaris2/filesystem.rb +8 -8
  116. data/spec/unit/plugins/solaris2/kernel_spec.rb +1 -1
  117. data/spec/unit/plugins/solaris2/network_spec.rb +92 -93
  118. data/spec/unit/plugins/solaris2/platform_spec.rb +24 -24
  119. data/spec/unit/plugins/solaris2/virtualization_spec.rb +22 -22
  120. data/spec/unit/plugins/ssh_host_keys_spec.rb +12 -12
  121. data/spec/unit/plugins/sysconf_spec.rb +321 -321
  122. data/spec/unit/plugins/virtualbox_spec.rb +27 -27
  123. data/spec/unit/plugins/windows/cpu_spec.rb +9 -9
  124. data/spec/unit/plugins/windows/kernel_spec.rb +12 -12
  125. data/spec/unit/plugins/windows/uptime_spec.rb +1 -1
  126. data/spec/unit/plugins/zpools_spec.rb +41 -41
  127. data/spec/unit/runner_spec.rb +2 -2
  128. data/spec/unit/system_spec.rb +55 -55
  129. metadata +3 -4
  130. data/docs/man/man1/ohai.1 +0 -97
@@ -35,24 +35,24 @@ describe Ohai::System, "plugin eucalyptus" do
35
35
  @http_client = double("Net::HTTP client")
36
36
  allow(plugin).to receive(:http_client).and_return(@http_client)
37
37
 
38
- expect(@http_client).to receive(:get).
39
- with("/").
40
- and_return(double("Net::HTTP Response", :body => "2012-01-12", :code => "200"))
41
- expect(@http_client).to receive(:get).
42
- with("/2012-01-12/meta-data/").
43
- and_return(double("Net::HTTP Response", :body => "instance_type\nami_id\nsecurity-groups", :code => "200"))
44
- expect(@http_client).to receive(:get).
45
- with("/2012-01-12/meta-data/instance_type").
46
- and_return(double("Net::HTTP Response", :body => "c1.medium", :code => "200"))
47
- expect(@http_client).to receive(:get).
48
- with("/2012-01-12/meta-data/ami_id").
49
- and_return(double("Net::HTTP Response", :body => "ami-5d2dc934", :code => "200"))
50
- expect(@http_client).to receive(:get).
51
- with("/2012-01-12/meta-data/security-groups").
52
- and_return(double("Net::HTTP Response", :body => "group1\ngroup2", :code => "200"))
53
- expect(@http_client).to receive(:get).
54
- with("/2012-01-12/user-data/").
55
- and_return(double("Net::HTTP Response", :body => "By the pricking of my thumb...", :code => "200"))
38
+ expect(@http_client).to receive(:get)
39
+ .with("/")
40
+ .and_return(double("Net::HTTP Response", body: "2012-01-12", code: "200"))
41
+ expect(@http_client).to receive(:get)
42
+ .with("/2012-01-12/meta-data/")
43
+ .and_return(double("Net::HTTP Response", body: "instance_type\nami_id\nsecurity-groups", code: "200"))
44
+ expect(@http_client).to receive(:get)
45
+ .with("/2012-01-12/meta-data/instance_type")
46
+ .and_return(double("Net::HTTP Response", body: "c1.medium", code: "200"))
47
+ expect(@http_client).to receive(:get)
48
+ .with("/2012-01-12/meta-data/ami_id")
49
+ .and_return(double("Net::HTTP Response", body: "ami-5d2dc934", code: "200"))
50
+ expect(@http_client).to receive(:get)
51
+ .with("/2012-01-12/meta-data/security-groups")
52
+ .and_return(double("Net::HTTP Response", body: "group1\ngroup2", code: "200"))
53
+ expect(@http_client).to receive(:get)
54
+ .with("/2012-01-12/user-data/")
55
+ .and_return(double("Net::HTTP Response", body: "By the pricking of my thumb...", code: "200"))
56
56
  end
57
57
 
58
58
  it "recursively fetches all the eucalyptus metadata" do
@@ -97,7 +97,7 @@ describe Ohai::System, "plugin eucalyptus" do
97
97
  it_behaves_like "!eucalyptus"
98
98
 
99
99
  before(:each) do
100
- plugin[:network] = { :interfaces => {} }
100
+ plugin[:network] = { interfaces: {} }
101
101
  allow(plugin).to receive(:hint?).with("eucalyptus").and_return(false)
102
102
  end
103
103
  end
@@ -55,7 +55,7 @@ shared_examples "a v7 loading failure" do
55
55
 
56
56
  it "should not have attribute keys" do
57
57
  @loader.load_plugin("#{tmp}/plugins/fail.rb")
58
- #@ohai.attributes.should_not have_key("fail")
58
+ # @ohai.attributes.should_not have_key("fail")
59
59
  expect { @ohai.provides_map.find_providers_for(["fail"]) }.to raise_error(Ohai::Exceptions::AttributeNotFound)
60
60
  end
61
61
 
@@ -152,23 +152,23 @@ shared_examples "a v7 run failure" do
152
152
  end
153
153
 
154
154
  describe "when using DSL commands outside Ohai.plugin block" do
155
- failstr1 = <<EOF
156
- provides "fail"
157
- Ohai.plugin do
158
- end
155
+ failstr1 = <<~EOF
156
+ provides "fail"
157
+ Ohai.plugin do
158
+ end
159
159
  EOF
160
160
 
161
- failstr2 = <<EOF
162
- depends "fail"
163
- Ohai.plugin do
164
- end
161
+ failstr2 = <<~EOF
162
+ depends "fail"
163
+ Ohai.plugin do
164
+ end
165
165
  EOF
166
166
 
167
- failstr3 = <<EOF
168
- collect_data do
169
- end
170
- Ohai.plugin do
171
- end
167
+ failstr3 = <<~EOF
168
+ collect_data do
169
+ end
170
+ Ohai.plugin do
171
+ end
172
172
  EOF
173
173
 
174
174
  it_behaves_like "a v7 loading failure" do
@@ -23,21 +23,21 @@ describe Ohai::System, "FreeBSD cpu plugin on FreeBSD >=10.2" do
23
23
  @plugin = get_plugin("freebsd/cpu")
24
24
  allow(@plugin).to receive(:collect_os).and_return(:freebsd)
25
25
  @double_file = double("/var/run/dmesg.boot")
26
- allow(@double_file).to receive(:each).
27
- and_yield("CPU: Intel(R) Core(TM) i7-4980HQ CPU @ 2.80GHz (2793.59-MHz K8-class CPU)").
28
- and_yield(' Origin="GenuineIntel" Id=0x40661 Family=0x6 Model=0x46 Stepping=1').
29
- and_yield(" Features=0x783fbff<FPU,VME,DE,PSE,TSC,MSR,PAE,MCE,CX8,APIC,SEP,MTRR,PGE,MCA,CMOV,PAT,PSE36,MMX,FXSR,SSE,SSE2>").
30
- and_yield(" Features2=0x5ed8220b<SSE3,PCLMULQDQ,MON,SSSE3,CX16,SSE4.1,SSE4.2,MOVBE,POPCNT,AESNI,XSAVE,OSXSAVE,AVX,RDRAND>").
31
- and_yield(" AMD Features=0x28100800<SYSCALL,NX,RDTSCP,LM>").
32
- and_yield(" AMD Features2=0x21<LAHF,ABM>").
33
- and_yield(" Structured Extended Features=0x2000<NFPUSG>").
34
- and_yield(" TSC: P-state invariant").
35
- and_yield("real memory = 1073676288 (1023 MB)").
36
- and_yield("avail memory = 1010253824 (963 MB)").
37
- and_yield('Event timer "LAPIC" quality 400').
38
- and_yield("ACPI APIC Table: <VBOX VBOXAPIC>").
39
- and_yield("FreeBSD/SMP: Multiprocessor System Detected: 16 CPUs").
40
- and_yield("FreeBSD/SMP: 2 package(s) x 4 core(s) x 2 SMT threads")
26
+ allow(@double_file).to receive(:each)
27
+ .and_yield("CPU: Intel(R) Core(TM) i7-4980HQ CPU @ 2.80GHz (2793.59-MHz K8-class CPU)")
28
+ .and_yield(' Origin="GenuineIntel" Id=0x40661 Family=0x6 Model=0x46 Stepping=1')
29
+ .and_yield(" Features=0x783fbff<FPU,VME,DE,PSE,TSC,MSR,PAE,MCE,CX8,APIC,SEP,MTRR,PGE,MCA,CMOV,PAT,PSE36,MMX,FXSR,SSE,SSE2>")
30
+ .and_yield(" Features2=0x5ed8220b<SSE3,PCLMULQDQ,MON,SSSE3,CX16,SSE4.1,SSE4.2,MOVBE,POPCNT,AESNI,XSAVE,OSXSAVE,AVX,RDRAND>")
31
+ .and_yield(" AMD Features=0x28100800<SYSCALL,NX,RDTSCP,LM>")
32
+ .and_yield(" AMD Features2=0x21<LAHF,ABM>")
33
+ .and_yield(" Structured Extended Features=0x2000<NFPUSG>")
34
+ .and_yield(" TSC: P-state invariant")
35
+ .and_yield("real memory = 1073676288 (1023 MB)")
36
+ .and_yield("avail memory = 1010253824 (963 MB)")
37
+ .and_yield('Event timer "LAPIC" quality 400')
38
+ .and_yield("ACPI APIC Table: <VBOX VBOXAPIC>")
39
+ .and_yield("FreeBSD/SMP: Multiprocessor System Detected: 16 CPUs")
40
+ .and_yield("FreeBSD/SMP: 2 package(s) x 4 core(s) x 2 SMT threads")
41
41
  allow(File).to receive(:open).with("/var/run/dmesg.boot").and_return(@double_file)
42
42
  end
43
43
 
@@ -99,9 +99,9 @@ describe Ohai::System, "FreeBSD cpu plugin on FreeBSD <=10.1" do
99
99
  allow(@plugin).to receive(:collect_os).and_return(:freebsd)
100
100
  allow(@plugin).to receive(:shell_out).with("sysctl -n hw.ncpu").and_return(mock_shell_out(0, "2", ""))
101
101
  @double_file = double("/var/run/dmesg.boot")
102
- allow(@double_file).to receive(:each).
103
- and_yield("CPU: Intel(R) Atom(TM) CPU N270 @ 1.60GHz (1596.03-MHz 686-class CPU)").
104
- and_yield(' Origin = "GenuineIntel" Id = 0x106c2 Family = 0x6 Model = 0x1c Stepping = 2')
102
+ allow(@double_file).to receive(:each)
103
+ .and_yield("CPU: Intel(R) Atom(TM) CPU N270 @ 1.60GHz (1596.03-MHz 686-class CPU)")
104
+ .and_yield(' Origin = "GenuineIntel" Id = 0x106c2 Family = 0x6 Model = 0x1c Stepping = 2')
105
105
  allow(File).to receive(:open).with("/var/run/dmesg.boot").and_return(@double_file)
106
106
  end
107
107
 
@@ -22,7 +22,7 @@ describe Ohai::System, "FreeBSD kernel plugin" do
22
22
  before(:each) do
23
23
  @plugin = get_plugin("kernel")
24
24
  allow(@plugin).to receive(:collect_os).and_return(:freebsd)
25
- allow(@plugin).to receive(:init_kernel).and_return({ :name => "freebsd" })
25
+ allow(@plugin).to receive(:init_kernel).and_return({ name: "freebsd" })
26
26
  allow(@plugin).to receive(:shell_out).with("uname -i").and_return(mock_shell_out(0, "foo\n", ""))
27
27
  allow(@plugin).to receive(:shell_out).with("sysctl kern.securelevel").and_return(mock_shell_out(0, "kern.securelevel: 1", ""))
28
28
  allow(@plugin).to receive(:shell_out).with( Ohai.abs_path( "/sbin/kldstat" )).and_return(mock_shell_out(0, " 1 7 0xc0400000 97f830 kernel", ""))
@@ -36,7 +36,7 @@ describe Ohai::System, "plugin gce" do
36
36
  shared_examples_for "gce" do
37
37
  before(:each) do
38
38
  @http_get = double("Net::HTTP client")
39
- allow(plugin).to receive(:http_get).and_return(double("Net::HTTP Response", :body => '{"instance":{"hostname":"test-host"}}', :code => "200"))
39
+ allow(plugin).to receive(:http_get).and_return(double("Net::HTTP Response", body: '{"instance":{"hostname":"test-host"}}', code: "200"))
40
40
  allow(IO).to receive(:select).and_return([[], [1], []])
41
41
  t = double("connection")
42
42
  allow(t).to receive(:connect_nonblock).and_raise(Errno::EINPROGRESS)
@@ -28,7 +28,7 @@ describe Ohai::System, "Init package" do
28
28
  let(:proc1_content) { "init\n" }
29
29
  let(:proc1_exists) { true }
30
30
  let(:proc_1_file_path) { "/proc/1/comm" }
31
- let(:proc_1_file) { double(proc_1_file_path, :gets => proc1_content) }
31
+ let(:proc_1_file) { double(proc_1_file_path, gets: proc1_content) }
32
32
 
33
33
  before(:each) do
34
34
  allow(File).to receive(:exist?).with(proc_1_file_path).and_return(proc1_exists)
@@ -193,8 +193,8 @@ describe Ohai::System, "plugin java (Java5 Client VM)" do
193
193
 
194
194
  context "and real Java is installed" do
195
195
  before do
196
- java_home_status = double(Process::Status, :success? => true)
197
- java_home_cmd = double(Mixlib::ShellOut, :status => java_home_status)
196
+ java_home_status = double(Process::Status, success?: true)
197
+ java_home_cmd = double(Mixlib::ShellOut, status: java_home_status)
198
198
  expect(plugin).to receive(:shell_out).with("/usr/libexec/java_home").and_return(java_home_cmd)
199
199
  end
200
200
 
@@ -211,8 +211,8 @@ describe Ohai::System, "plugin java (Java5 Client VM)" do
211
211
 
212
212
  context "and the JVM stubs are installed" do
213
213
  before do
214
- java_home_status = double(Process::Status, :success? => false)
215
- java_home_cmd = double(Mixlib::ShellOut, :status => java_home_status)
214
+ java_home_status = double(Process::Status, success?: false)
215
+ java_home_cmd = double(Mixlib::ShellOut, status: java_home_status)
216
216
  expect(plugin).to receive(:shell_out).with("/usr/libexec/java_home").and_return(java_home_cmd)
217
217
  end
218
218
 
@@ -61,17 +61,17 @@ describe Ohai::System, "plugin joyent" do
61
61
  plugin[:virtualization][:guest_uuid] = "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxx"
62
62
  plugin[:virtualization][:guest_id] = "30"
63
63
 
64
- etc_product = <<-EOS
65
- Name: Joyent Instance
66
- Image: pkgbuild 16.3.1
67
- Documentation: https://docs.joyent.com/images/smartos/pkgbuild
64
+ etc_product = <<~EOS
65
+ Name: Joyent Instance
66
+ Image: pkgbuild 16.3.1
67
+ Documentation: https://docs.joyent.com/images/smartos/pkgbuild
68
68
  EOS
69
69
 
70
- pkg_install_conf = <<-EOS
71
- GPG_KEYRING_VERIFY=/opt/local/etc/gnupg/pkgsrc.gpg
72
- GPG_KEYRING_PKGVULN=/opt/local/share/gnupg/pkgsrc-security.gpg
73
- PKG_PATH=https://pkgsrc.joyent.com/packages/SmartOS/2016Q3/x86_64/All
74
- VERIFIED_INSTALLATION=trusted
70
+ pkg_install_conf = <<~EOS
71
+ GPG_KEYRING_VERIFY=/opt/local/etc/gnupg/pkgsrc.gpg
72
+ GPG_KEYRING_PKGVULN=/opt/local/share/gnupg/pkgsrc-security.gpg
73
+ PKG_PATH=https://pkgsrc.joyent.com/packages/SmartOS/2016Q3/x86_64/All
74
+ VERIFIED_INSTALLATION=trusted
75
75
  EOS
76
76
 
77
77
  allow(::File).to receive(:read).with("/etc/product").and_return(etc_product)
@@ -33,7 +33,7 @@ describe Ohai::System, "Linux Block Device Plugin" do
33
33
  "size" => "7806976",
34
34
  "removable" => "0",
35
35
  },
36
- }
36
+ }.freeze
37
37
 
38
38
  def file_double(value)
39
39
  tmp_double = double
@@ -42,20 +42,20 @@ shared_examples "S390 processor info" do |cpu_no, version, identification, machi
42
42
  describe "S390 processor" do
43
43
  it "has a version for cpu #{cpu_no}" do
44
44
  plugin.run
45
- expect(plugin[:cpu]["#{cpu_no}"]).to have_key("version")
46
- expect(plugin[:cpu]["#{cpu_no}"]["version"]).to eql(version)
45
+ expect(plugin[:cpu][cpu_no.to_s]).to have_key("version")
46
+ expect(plugin[:cpu][cpu_no.to_s]["version"]).to eql(version)
47
47
  end
48
48
 
49
49
  it "has a identification for cpu #{cpu_no}" do
50
50
  plugin.run
51
- expect(plugin[:cpu]["#{cpu_no}"]).to have_key("identification")
52
- expect(plugin[:cpu]["#{cpu_no}"]["identification"]).to eql(identification)
51
+ expect(plugin[:cpu][cpu_no.to_s]).to have_key("identification")
52
+ expect(plugin[:cpu][cpu_no.to_s]["identification"]).to eql(identification)
53
53
  end
54
54
 
55
55
  it "has a machine for cpu #{cpu_no}" do
56
56
  plugin.run
57
- expect(plugin[:cpu]["#{cpu_no}"]).to have_key("machine")
58
- expect(plugin[:cpu]["#{cpu_no}"]["machine"]).to eql(machine)
57
+ expect(plugin[:cpu][cpu_no.to_s]).to have_key("machine")
58
+ expect(plugin[:cpu][cpu_no.to_s]["machine"]).to eql(machine)
59
59
  end
60
60
  end
61
61
  end
@@ -64,14 +64,14 @@ shared_examples "arm64 processor info" do |cpu_no, bogomips, features|
64
64
  describe "arm64 processor" do
65
65
  it "has bogomips for cpu #{cpu_no}" do
66
66
  plugin.run
67
- expect(plugin[:cpu]["#{cpu_no}"]).to have_key("bogomips")
68
- expect(plugin[:cpu]["#{cpu_no}"]["bogomips"]).to eql(bogomips)
67
+ expect(plugin[:cpu][cpu_no.to_s]).to have_key("bogomips")
68
+ expect(plugin[:cpu][cpu_no.to_s]["bogomips"]).to eql(bogomips)
69
69
  end
70
70
 
71
71
  it "has features for cpu #{cpu_no}" do
72
72
  plugin.run
73
- expect(plugin[:cpu]["#{cpu_no}"]).to have_key("features")
74
- expect(plugin[:cpu]["#{cpu_no}"]["features"]).to eql(features)
73
+ expect(plugin[:cpu][cpu_no.to_s]).to have_key("features")
74
+ expect(plugin[:cpu][cpu_no.to_s]["features"]).to eql(features)
75
75
  end
76
76
  end
77
77
  end
@@ -126,31 +126,31 @@ describe Ohai::System, "General Linux cpu plugin" do
126
126
  end
127
127
 
128
128
  let(:lscpu) do
129
- <<-EOF
130
- Architecture: x86_64
131
- CPU op-mode(s): 32-bit, 64-bit
132
- Byte Order: Little Endian
133
- CPU(s): 1
134
- On-line CPU(s) list: 0
135
- Thread(s) per core: 1
136
- Core(s) per socket: 1
137
- Socket(s): 1
138
- NUMA node(s): 1
139
- Vendor ID: GenuineIntel
140
- CPU family: 6
141
- Model: 23
142
- Model name: Intel(R) Core(TM)2 Duo CPU T8300 @ 2.40GHz
143
- Stepping: 2
144
- CPU MHz: 1968.770
145
- BogoMIPS: 2575.86
146
- Hypervisor vendor: Xen
147
- Virtualization type: full
148
- L1d cache: 32K
149
- L1i cache: 32K
150
- L2 cache: 256K
151
- L3 cache: 30720K
152
- NUMA node0 CPU(s): 0
153
- Flags: fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush mmx fxsr sse sse2 ht syscall nx rdtscp lm constant_tsc rep_good nopl xtopology pni pclmulqdq ssse3 fma cx16 pcid sse4_1 sse4_2 x2apic movbe popcnt tsc_deadline_timer aes xsave avx f16c rdrand hypervisor lahf_lm abm fsgsbase bmi1 avx2 smep bmi2 erms invpcid xsaveopt
129
+ <<~EOF
130
+ Architecture: x86_64
131
+ CPU op-mode(s): 32-bit, 64-bit
132
+ Byte Order: Little Endian
133
+ CPU(s): 1
134
+ On-line CPU(s) list: 0
135
+ Thread(s) per core: 1
136
+ Core(s) per socket: 1
137
+ Socket(s): 1
138
+ NUMA node(s): 1
139
+ Vendor ID: GenuineIntel
140
+ CPU family: 6
141
+ Model: 23
142
+ Model name: Intel(R) Core(TM)2 Duo CPU T8300 @ 2.40GHz
143
+ Stepping: 2
144
+ CPU MHz: 1968.770
145
+ BogoMIPS: 2575.86
146
+ Hypervisor vendor: Xen
147
+ Virtualization type: full
148
+ L1d cache: 32K
149
+ L1i cache: 32K
150
+ L2 cache: 256K
151
+ L3 cache: 30720K
152
+ NUMA node0 CPU(s): 0
153
+ Flags: fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush mmx fxsr sse sse2 ht syscall nx rdtscp lm constant_tsc rep_good nopl xtopology pni pclmulqdq ssse3 fma cx16 pcid sse4_1 sse4_2 x2apic movbe popcnt tsc_deadline_timer aes xsave avx f16c rdrand hypervisor lahf_lm abm fsgsbase bmi1 avx2 smep bmi2 erms invpcid xsaveopt
154
154
  EOF
155
155
  end
156
156
 
@@ -235,110 +235,110 @@ Flags: fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca
235
235
  end
236
236
  context "with a dual-core hyperthreaded /proc/cpuinfo" do
237
237
  let(:cpuinfo_contents) do
238
- <<-EOF
239
- processor : 0
240
- vendor_id : GenuineIntel
241
- cpu family : 6
242
- model : 69
243
- model name : Intel(R) Core(TM) i7-4500U CPU @ 1.80GHz
244
- stepping : 1
245
- microcode : 0x17
246
- cpu MHz : 774.000
247
- cache size : 4096 KB
248
- physical id : 0
249
- siblings : 4
250
- core id : 0
251
- cpu cores : 2
252
- apicid : 0
253
- initial apicid : 0
254
- fpu : yes
255
- fpu_exception : yes
256
- cpuid level : 13
257
- wp : yes
258
- flags : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe syscall nx pdpe1gb rdtscp lm constant_tsc arch_perfmon pebs bts rep_good nopl xtopology nonstop_tsc aperfmperf eagerfpu pni pclmulqdq dtes64 monitor ds_cpl vmx est tm2 ssse3 fma cx16 xtpr pdcm pcid sse4_1 sse4_2 movbe popcnt tsc_deadline_timer aes xsave avx f16c rdrand lahf_lm abm ida arat epb xsaveopt pln pts dtherm tpr_shadow vnmi flexpriority ept vpid fsgsbase tsc_adjust bmi1 avx2 smep bmi2 erms invpcid
259
- bogomips : 3591.40
260
- clflush size : 64
261
- cache_alignment : 64
262
- address sizes : 39 bits physical, 48 bits virtual
263
- power management:
264
-
265
- processor : 1
266
- vendor_id : GenuineIntel
267
- cpu family : 6
268
- model : 69
269
- model name : Intel(R) Core(TM) i7-4500U CPU @ 1.80GHz
270
- stepping : 1
271
- microcode : 0x17
272
- cpu MHz : 1600.000
273
- cache size : 4096 KB
274
- physical id : 0
275
- siblings : 4
276
- core id : 0
277
- cpu cores : 2
278
- apicid : 1
279
- initial apicid : 1
280
- fpu : yes
281
- fpu_exception : yes
282
- cpuid level : 13
283
- wp : yes
284
- flags : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe syscall nx pdpe1gb rdtscp lm constant_tsc arch_perfmon pebs bts rep_good nopl xtopology nonstop_tsc aperfmperf eagerfpu pni pclmulqdq dtes64 monitor ds_cpl vmx est tm2 ssse3 fma cx16 xtpr pdcm pcid sse4_1 sse4_2 movbe popcnt tsc_deadline_timer aes xsave avx f16c rdrand lahf_lm abm ida arat epb xsaveopt pln pts dtherm tpr_shadow vnmi flexpriority ept vpid fsgsbase tsc_adjust bmi1 avx2 smep bmi2 erms invpcid
285
- bogomips : 3591.40
286
- clflush size : 64
287
- cache_alignment : 64
288
- address sizes : 39 bits physical, 48 bits virtual
289
- power management:
290
-
291
- processor : 2
292
- vendor_id : GenuineIntel
293
- cpu family : 6
294
- model : 69
295
- model name : Intel(R) Core(TM) i7-4500U CPU @ 1.80GHz
296
- stepping : 1
297
- microcode : 0x17
298
- cpu MHz : 800.000
299
- cache size : 4096 KB
300
- physical id : 0
301
- siblings : 4
302
- core id : 1
303
- cpu cores : 2
304
- apicid : 2
305
- initial apicid : 2
306
- fpu : yes
307
- fpu_exception : yes
308
- cpuid level : 13
309
- wp : yes
310
- flags : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe syscall nx pdpe1gb rdtscp lm constant_tsc arch_perfmon pebs bts rep_good nopl xtopology nonstop_tsc aperfmperf eagerfpu pni pclmulqdq dtes64 monitor ds_cpl vmx est tm2 ssse3 fma cx16 xtpr pdcm pcid sse4_1 sse4_2 movbe popcnt tsc_deadline_timer aes xsave avx f16c rdrand lahf_lm abm ida arat epb xsaveopt pln pts dtherm tpr_shadow vnmi flexpriority ept vpid fsgsbase tsc_adjust bmi1 avx2 smep bmi2 erms invpcid
311
- bogomips : 3591.40
312
- clflush size : 64
313
- cache_alignment : 64
314
- address sizes : 39 bits physical, 48 bits virtual
315
- power management:
316
-
317
- processor : 3
318
- vendor_id : GenuineIntel
319
- cpu family : 6
320
- model : 69
321
- model name : Intel(R) Core(TM) i7-4500U CPU @ 1.80GHz
322
- stepping : 1
323
- microcode : 0x17
324
- cpu MHz : 774.000
325
- cache size : 4096 KB
326
- physical id : 0
327
- siblings : 4
328
- core id : 1
329
- cpu cores : 2
330
- apicid : 3
331
- initial apicid : 3
332
- fpu : yes
333
- fpu_exception : yes
334
- cpuid level : 13
335
- wp : yes
336
- flags : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe syscall nx pdpe1gb rdtscp lm constant_tsc arch_perfmon pebs bts rep_good nopl xtopology nonstop_tsc aperfmperf eagerfpu pni pclmulqdq dtes64 monitor ds_cpl vmx est tm2 ssse3 fma cx16 xtpr pdcm pcid sse4_1 sse4_2 movbe popcnt tsc_deadline_timer aes xsave avx f16c rdrand lahf_lm abm ida arat epb xsaveopt pln pts dtherm tpr_shadow vnmi flexpriority ept vpid fsgsbase tsc_adjust bmi1 avx2 smep bmi2 erms invpcid
337
- bogomips : 3591.40
338
- clflush size : 64
339
- cache_alignment : 64
340
- address sizes : 39 bits physical, 48 bits virtual
341
- power management:
238
+ <<~EOF
239
+ processor : 0
240
+ vendor_id : GenuineIntel
241
+ cpu family : 6
242
+ model : 69
243
+ model name : Intel(R) Core(TM) i7-4500U CPU @ 1.80GHz
244
+ stepping : 1
245
+ microcode : 0x17
246
+ cpu MHz : 774.000
247
+ cache size : 4096 KB
248
+ physical id : 0
249
+ siblings : 4
250
+ core id : 0
251
+ cpu cores : 2
252
+ apicid : 0
253
+ initial apicid : 0
254
+ fpu : yes
255
+ fpu_exception : yes
256
+ cpuid level : 13
257
+ wp : yes
258
+ flags : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe syscall nx pdpe1gb rdtscp lm constant_tsc arch_perfmon pebs bts rep_good nopl xtopology nonstop_tsc aperfmperf eagerfpu pni pclmulqdq dtes64 monitor ds_cpl vmx est tm2 ssse3 fma cx16 xtpr pdcm pcid sse4_1 sse4_2 movbe popcnt tsc_deadline_timer aes xsave avx f16c rdrand lahf_lm abm ida arat epb xsaveopt pln pts dtherm tpr_shadow vnmi flexpriority ept vpid fsgsbase tsc_adjust bmi1 avx2 smep bmi2 erms invpcid
259
+ bogomips : 3591.40
260
+ clflush size : 64
261
+ cache_alignment : 64
262
+ address sizes : 39 bits physical, 48 bits virtual
263
+ power management:
264
+
265
+ processor : 1
266
+ vendor_id : GenuineIntel
267
+ cpu family : 6
268
+ model : 69
269
+ model name : Intel(R) Core(TM) i7-4500U CPU @ 1.80GHz
270
+ stepping : 1
271
+ microcode : 0x17
272
+ cpu MHz : 1600.000
273
+ cache size : 4096 KB
274
+ physical id : 0
275
+ siblings : 4
276
+ core id : 0
277
+ cpu cores : 2
278
+ apicid : 1
279
+ initial apicid : 1
280
+ fpu : yes
281
+ fpu_exception : yes
282
+ cpuid level : 13
283
+ wp : yes
284
+ flags : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe syscall nx pdpe1gb rdtscp lm constant_tsc arch_perfmon pebs bts rep_good nopl xtopology nonstop_tsc aperfmperf eagerfpu pni pclmulqdq dtes64 monitor ds_cpl vmx est tm2 ssse3 fma cx16 xtpr pdcm pcid sse4_1 sse4_2 movbe popcnt tsc_deadline_timer aes xsave avx f16c rdrand lahf_lm abm ida arat epb xsaveopt pln pts dtherm tpr_shadow vnmi flexpriority ept vpid fsgsbase tsc_adjust bmi1 avx2 smep bmi2 erms invpcid
285
+ bogomips : 3591.40
286
+ clflush size : 64
287
+ cache_alignment : 64
288
+ address sizes : 39 bits physical, 48 bits virtual
289
+ power management:
290
+
291
+ processor : 2
292
+ vendor_id : GenuineIntel
293
+ cpu family : 6
294
+ model : 69
295
+ model name : Intel(R) Core(TM) i7-4500U CPU @ 1.80GHz
296
+ stepping : 1
297
+ microcode : 0x17
298
+ cpu MHz : 800.000
299
+ cache size : 4096 KB
300
+ physical id : 0
301
+ siblings : 4
302
+ core id : 1
303
+ cpu cores : 2
304
+ apicid : 2
305
+ initial apicid : 2
306
+ fpu : yes
307
+ fpu_exception : yes
308
+ cpuid level : 13
309
+ wp : yes
310
+ flags : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe syscall nx pdpe1gb rdtscp lm constant_tsc arch_perfmon pebs bts rep_good nopl xtopology nonstop_tsc aperfmperf eagerfpu pni pclmulqdq dtes64 monitor ds_cpl vmx est tm2 ssse3 fma cx16 xtpr pdcm pcid sse4_1 sse4_2 movbe popcnt tsc_deadline_timer aes xsave avx f16c rdrand lahf_lm abm ida arat epb xsaveopt pln pts dtherm tpr_shadow vnmi flexpriority ept vpid fsgsbase tsc_adjust bmi1 avx2 smep bmi2 erms invpcid
311
+ bogomips : 3591.40
312
+ clflush size : 64
313
+ cache_alignment : 64
314
+ address sizes : 39 bits physical, 48 bits virtual
315
+ power management:
316
+
317
+ processor : 3
318
+ vendor_id : GenuineIntel
319
+ cpu family : 6
320
+ model : 69
321
+ model name : Intel(R) Core(TM) i7-4500U CPU @ 1.80GHz
322
+ stepping : 1
323
+ microcode : 0x17
324
+ cpu MHz : 774.000
325
+ cache size : 4096 KB
326
+ physical id : 0
327
+ siblings : 4
328
+ core id : 1
329
+ cpu cores : 2
330
+ apicid : 3
331
+ initial apicid : 3
332
+ fpu : yes
333
+ fpu_exception : yes
334
+ cpuid level : 13
335
+ wp : yes
336
+ flags : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe syscall nx pdpe1gb rdtscp lm constant_tsc arch_perfmon pebs bts rep_good nopl xtopology nonstop_tsc aperfmperf eagerfpu pni pclmulqdq dtes64 monitor ds_cpl vmx est tm2 ssse3 fma cx16 xtpr pdcm pcid sse4_1 sse4_2 movbe popcnt tsc_deadline_timer aes xsave avx f16c rdrand lahf_lm abm ida arat epb xsaveopt pln pts dtherm tpr_shadow vnmi flexpriority ept vpid fsgsbase tsc_adjust bmi1 avx2 smep bmi2 erms invpcid
337
+ bogomips : 3591.40
338
+ clflush size : 64
339
+ cache_alignment : 64
340
+ address sizes : 39 bits physical, 48 bits virtual
341
+ power management:
342
342
 
343
343
  EOF
344
344
  end
@@ -368,13 +368,13 @@ describe Ohai::System, "S390 linux cpu plugin" do
368
368
  allow(plugin).to receive(:shell_out).with("lscpu").and_return(mock_shell_out(1, "", ""))
369
369
 
370
370
  @double_file = double("/proc/cpuinfo")
371
- allow(@double_file).to receive(:each).
372
- and_yield("vendor_id : IBM/S390").
373
- and_yield("# processors : 2").
374
- and_yield("bogomips per cpu: 9328.00").
375
- and_yield("features : esan3 zarch stfle msa ldisp eimm dfp etf3eh highgprs").
376
- and_yield("processor 0: version = EE, identification = 06E276, machine = 2717").
377
- and_yield("processor 1: version = FF, identification = 06E278, machine = 2818")
371
+ allow(@double_file).to receive(:each)
372
+ .and_yield("vendor_id : IBM/S390")
373
+ .and_yield("# processors : 2")
374
+ .and_yield("bogomips per cpu: 9328.00")
375
+ .and_yield("features : esan3 zarch stfle msa ldisp eimm dfp etf3eh highgprs")
376
+ .and_yield("processor 0: version = EE, identification = 06E276, machine = 2717")
377
+ .and_yield("processor 1: version = FF, identification = 06E278, machine = 2818")
378
378
  allow(File).to receive(:open).with("/proc/cpuinfo").and_return(@double_file)
379
379
  end
380
380
 
@@ -415,15 +415,15 @@ describe Ohai::System, "arm64 linux cpu plugin" do
415
415
  allow(plugin).to receive(:shell_out).with("lscpu").and_return(mock_shell_out(1, "", ""))
416
416
 
417
417
  @double_file = double("/proc/cpuinfo")
418
- allow(@double_file).to receive(:each).
419
- and_yield("processor : 0").
420
- and_yield("BogoMIPS : 40.00").
421
- and_yield("Features : fp asimd evtstrm aes pmull sha1 sha2 crc32").
422
- and_yield("").
423
- and_yield("processor : 1").
424
- and_yield("BogoMIPS : 40.00").
425
- and_yield("Features : fp asimd evtstrm aes pmull sha1 sha2 crc32").
426
- and_yield("")
418
+ allow(@double_file).to receive(:each)
419
+ .and_yield("processor : 0")
420
+ .and_yield("BogoMIPS : 40.00")
421
+ .and_yield("Features : fp asimd evtstrm aes pmull sha1 sha2 crc32")
422
+ .and_yield("")
423
+ .and_yield("processor : 1")
424
+ .and_yield("BogoMIPS : 40.00")
425
+ .and_yield("Features : fp asimd evtstrm aes pmull sha1 sha2 crc32")
426
+ .and_yield("")
427
427
  allow(File).to receive(:open).with("/proc/cpuinfo").and_return(@double_file)
428
428
  end
429
429