ohai 13.1.0 → 13.2.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (65) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile +15 -6
  3. data/lib/ohai/common/dmi.rb +11 -13
  4. data/lib/ohai/dsl/plugin.rb +6 -8
  5. data/lib/ohai/dsl/plugin/versionvi.rb +1 -1
  6. data/lib/ohai/dsl/plugin/versionvii.rb +4 -4
  7. data/lib/ohai/mash.rb +1 -1
  8. data/lib/ohai/mixin/command.rb +3 -3
  9. data/lib/ohai/mixin/dmi_decode.rb +1 -1
  10. data/lib/ohai/mixin/ec2_metadata.rb +10 -10
  11. data/lib/ohai/mixin/os.rb +11 -11
  12. data/lib/ohai/mixin/softlayer_metadata.rb +2 -2
  13. data/lib/ohai/mixin/string.rb +1 -1
  14. data/lib/ohai/plugins/azure.rb +2 -2
  15. data/lib/ohai/plugins/c.rb +9 -10
  16. data/lib/ohai/plugins/darwin/cpu.rb +24 -20
  17. data/lib/ohai/plugins/darwin/hardware.rb +15 -9
  18. data/lib/ohai/plugins/digital_ocean.rb +2 -2
  19. data/lib/ohai/plugins/ec2.rb +5 -5
  20. data/lib/ohai/plugins/elixir.rb +1 -1
  21. data/lib/ohai/plugins/erlang.rb +2 -2
  22. data/lib/ohai/plugins/eucalyptus.rb +2 -2
  23. data/lib/ohai/plugins/go.rb +1 -1
  24. data/lib/ohai/plugins/hostname.rb +7 -10
  25. data/lib/ohai/plugins/ip_scopes.rb +2 -0
  26. data/lib/ohai/plugins/java.rb +19 -21
  27. data/lib/ohai/plugins/kernel.rb +1 -1
  28. data/lib/ohai/plugins/linux/cpu.rb +4 -0
  29. data/lib/ohai/plugins/linux/filesystem.rb +43 -30
  30. data/lib/ohai/plugins/linux/lsb.rb +1 -1
  31. data/lib/ohai/plugins/linux/mdadm.rb +9 -1
  32. data/lib/ohai/plugins/linux/network.rb +8 -12
  33. data/lib/ohai/plugins/linux/platform.rb +9 -1
  34. data/lib/ohai/plugins/linux/systemd_paths.rb +39 -0
  35. data/lib/ohai/plugins/mono.rb +1 -1
  36. data/lib/ohai/plugins/nodejs.rb +1 -1
  37. data/lib/ohai/plugins/openstack.rb +5 -5
  38. data/lib/ohai/plugins/packages.rb +8 -2
  39. data/lib/ohai/plugins/perl.rb +1 -1
  40. data/lib/ohai/plugins/php.rb +1 -1
  41. data/lib/ohai/plugins/powershell.rb +1 -1
  42. data/lib/ohai/plugins/python.rb +1 -1
  43. data/lib/ohai/plugins/rackspace.rb +4 -4
  44. data/lib/ohai/plugins/rust.rb +1 -1
  45. data/lib/ohai/plugins/solaris2/dmi.rb +3 -3
  46. data/lib/ohai/plugins/solaris2/network.rb +2 -2
  47. data/lib/ohai/plugins/ssh_host_key.rb +1 -1
  48. data/lib/ohai/plugins/uptime.rb +1 -1
  49. data/lib/ohai/plugins/{solaris2/zpools.rb → zpools.rb} +39 -16
  50. data/lib/ohai/util/file_helper.rb +2 -2
  51. data/lib/ohai/version.rb +1 -1
  52. data/spec/data/plugins/lslpp.output +1 -0
  53. data/spec/unit/plugins/darwin/cpu_spec.rb +66 -19
  54. data/spec/unit/plugins/darwin/hardware_spec.rb +2 -14
  55. data/spec/unit/plugins/linux/cpu_spec.rb +47 -0
  56. data/spec/unit/plugins/linux/filesystem_spec.rb +99 -9
  57. data/spec/unit/plugins/linux/mdadm_spec.rb +26 -1
  58. data/spec/unit/plugins/linux/network_spec.rb +8 -26
  59. data/spec/unit/plugins/linux/platform_spec.rb +41 -0
  60. data/spec/unit/plugins/linux/systemd_paths_spec.rb +122 -0
  61. data/spec/unit/plugins/packages_spec.rb +4 -0
  62. data/spec/unit/plugins/rackspace_spec.rb +3 -3
  63. data/spec/unit/plugins/zpools_spec.rb +242 -0
  64. metadata +7 -5
  65. data/spec/unit/plugins/solaris2/zpools_spec.rb +0 -153
@@ -44,7 +44,7 @@ Ohai.plugin(:Mono) do
44
44
  languages[:mono] = mono unless mono.empty?
45
45
  end
46
46
  rescue Ohai::Exceptions::Exec
47
- Ohai::Log.debug('Mono plugin: Could not shell_out "mono -V". Skipping plugin')
47
+ Ohai::Log.debug('Plugin Mono: Could not shell_out "mono -V". Skipping plugin')
48
48
  end
49
49
  end
50
50
  end
@@ -34,7 +34,7 @@ Ohai.plugin(:Nodejs) do
34
34
  languages[:nodejs] = nodejs if nodejs[:version]
35
35
  end
36
36
  rescue Ohai::Exceptions::Exec
37
- Ohai::Log.debug('Nodejs plugin: Could not shell_out "node -v". Skipping plugin')
37
+ Ohai::Log.debug('Plugin Nodejs: Could not shell_out "node -v". Skipping plugin')
38
38
  end
39
39
  end
40
40
  end
@@ -32,10 +32,10 @@ Ohai.plugin(:Openstack) do
32
32
  # detect a manufacturer of OpenStack Foundation
33
33
  if get_attribute(:dmi, :system, :all_records, 0, :Manufacturer) =~ /OpenStack/
34
34
  Ohai::Log.debug("Plugin Openstack: has_openstack_dmi? == true")
35
- return true
35
+ true
36
36
  else
37
37
  Ohai::Log.debug("Plugin Openstack: has_openstack_dmi? == false")
38
- return false
38
+ false
39
39
  end
40
40
  end
41
41
 
@@ -43,17 +43,17 @@ Ohai.plugin(:Openstack) do
43
43
  def openstack_hint?
44
44
  if hint?("openstack")
45
45
  Ohai::Log.debug("Plugin Openstack: openstack hint present")
46
- return true
46
+ true
47
47
  else
48
48
  Ohai::Log.debug("Plugin Openstack: openstack hint not present")
49
- return false
49
+ false
50
50
  end
51
51
  end
52
52
 
53
53
  # dreamhost systems have the dhc-user on them
54
54
  def openstack_provider
55
55
  return "dreamhost" if get_attribute("etc", "passwd", "dhc-user")
56
- return "openstack"
56
+ "openstack"
57
57
  end
58
58
 
59
59
  collect_data do
@@ -94,8 +94,14 @@ Ohai.plugin(:Packages) do
94
94
  # Package Name:Fileset:Level
95
95
  # On aix, filesets are packages and levels are versions
96
96
  pkgs.each do |pkg|
97
- _, name, version = pkg.split(":")
98
- packages[name] = { "version" => version }
97
+ name, fileset, version, _, _, _, pkg_type = pkg.split(":")
98
+ if pkg_type == "R"
99
+ # RPM
100
+ packages[name] = { "version" => version }
101
+ else
102
+ # LPP
103
+ packages[fileset] = { "version" => version }
104
+ end
99
105
  end
100
106
  end
101
107
 
@@ -39,7 +39,7 @@ Ohai.plugin(:Perl) do
39
39
  languages[:perl] = perl unless perl.empty?
40
40
  end
41
41
  rescue Ohai::Exceptions::Exec
42
- Ohai::Log.debug('Perl plugin: Could not shell_out "perl -V:version -V:archname". Skipping plugin')
42
+ Ohai::Log.debug('Plugin Perl: Could not shell_out "perl -V:version -V:archname". Skipping plugin')
43
43
  end
44
44
  end
45
45
  end
@@ -46,7 +46,7 @@ Ohai.plugin(:PHP) do
46
46
  languages[:php] = php unless php.empty?
47
47
  end
48
48
  rescue Ohai::Exceptions::Exec
49
- Ohai::Log.debug('Php plugin: Could not shell_out "php -v". Skipping plugin')
49
+ Ohai::Log.debug('Plugin Php: Could not shell_out "php -v". Skipping plugin')
50
50
  end
51
51
  end
52
52
  end
@@ -51,7 +51,7 @@ Ohai.plugin(:Powershell) do
51
51
  languages[:powershell] = powershell unless powershell.empty?
52
52
  end
53
53
  rescue Ohai::Exceptions::Exec
54
- Ohai::Log.debug('Powershell plugin: Could not shell_out "powershell.exe -NoLogo -NonInteractive -NoProfile -command $PSVersionTable". Skipping plugin')
54
+ Ohai::Log.debug('Plugin Powershell: Could not shell_out "powershell.exe -NoLogo -NonInteractive -NoProfile -command $PSVersionTable". Skipping plugin')
55
55
  end
56
56
  end
57
57
 
@@ -37,7 +37,7 @@ Ohai.plugin(:Python) do
37
37
  languages[:python] = python unless python.empty?
38
38
  end
39
39
  rescue Ohai::Exceptions::Exec
40
- Ohai::Log.debug('Python plugin: Could not shell_out "python -c "import sys; print (sys.version)"". Skipping plugin')
40
+ Ohai::Log.debug('Plugin Python: Could not shell_out "python -c "import sys; print (sys.version)"". Skipping plugin')
41
41
  end
42
42
  end
43
43
  end
@@ -92,7 +92,7 @@ Ohai.plugin(:Rackspace) do
92
92
  end
93
93
  end
94
94
  rescue Ohai::Exceptions::Exec
95
- Ohai::Log.debug("rackspace plugin: Unable to find xenstore-ls, cannot capture region information for Rackspace cloud")
95
+ Ohai::Log.debug("Plugin Rackspace: Unable to find xenstore-ls, cannot capture region information for Rackspace cloud")
96
96
  nil
97
97
  end
98
98
 
@@ -104,7 +104,7 @@ Ohai.plugin(:Rackspace) do
104
104
  rackspace[:instance_id] = so.stdout.gsub(/instance-/, "")
105
105
  end
106
106
  rescue Ohai::Exceptions::Exec
107
- Ohai::Log.debug("rackspace plugin: Unable to find xenstore-read, cannot capture instance ID information for Rackspace cloud")
107
+ Ohai::Log.debug("Plugin Rackspace: Unable to find xenstore-read, cannot capture instance ID information for Rackspace cloud")
108
108
  nil
109
109
  end
110
110
 
@@ -119,7 +119,7 @@ Ohai.plugin(:Rackspace) do
119
119
  if so.exitstatus == 0
120
120
  networks.push(FFI_Yajl::Parser.new.parse(so.stdout))
121
121
  else
122
- Ohai::Log.debug("rackspace plugin: Unable to capture custom private networking information for Rackspace cloud")
122
+ Ohai::Log.debug("Plugin Rackspace: Unable to capture custom private networking information for Rackspace cloud")
123
123
  return false
124
124
  end
125
125
  end
@@ -128,7 +128,7 @@ Ohai.plugin(:Rackspace) do
128
128
  networks.delete_if { |hash| hash["label"] == "public" }
129
129
  end
130
130
  rescue Ohai::Exceptions::Exec
131
- Ohai::Log.debug("rackspace plugin: Unable to capture custom private networking information for Rackspace cloud")
131
+ Ohai::Log.debug("Plugin Rackspace: Unable to capture custom private networking information for Rackspace cloud")
132
132
  nil
133
133
  end
134
134
 
@@ -28,7 +28,7 @@ Ohai.plugin(:Rust) do
28
28
  languages[:rust] = rust if rust[:version]
29
29
  end
30
30
  rescue Ohai::Exceptions::Exec
31
- Ohai::Log.debug('Rust plugin: Could not shell_out "rustc --version". Skipping plugin')
31
+ Ohai::Log.debug('Plugin Rust: Could not shell_out "rustc --version". Skipping plugin')
32
32
  end
33
33
  end
34
34
  end
@@ -25,7 +25,7 @@ Ohai.plugin(:DMI) do
25
25
  # if we already have a "dmi" with keys (presumably from dmidecode), don't try smbios
26
26
  # note that a single key just means dmidecode exited with its version
27
27
  if (dmi.class.to_s == "Mash") && (dmi.keys.length > 1)
28
- Ohai::Log.debug("skipping smbios output, since DMI information has already been provided")
28
+ Ohai::Log.debug("Plugin DMI: skipping smbios output, since DMI information has already been provided")
29
29
  return
30
30
  end
31
31
 
@@ -118,7 +118,7 @@ Ohai.plugin(:DMI) do
118
118
  # remove/replace any characters that don't fall inside permissible ASCII range, or whitespace
119
119
  line = raw_line.gsub(/[^\x20-\x7E\n\t\r]/, ".")
120
120
  if line != raw_line
121
- Ohai::Log.debug("converted characters from line:\n#{raw_line}")
121
+ Ohai::Log.debug("Plugin DMI: converted characters from line:\n#{raw_line}")
122
122
  end
123
123
 
124
124
  if header_information = header_information_line.match(line)
@@ -137,7 +137,7 @@ Ohai.plugin(:DMI) do
137
137
  dmi_record[:type] = Ohai::Common::DMI.id_lookup(id)
138
138
 
139
139
  else
140
- Ohai::Log.debug("unrecognized header type; skipping")
140
+ Ohai::Log.debug("Plugin DMI: unrecognized header type; skipping")
141
141
  dmi_record = nil
142
142
  next
143
143
  end
@@ -180,11 +180,11 @@ Ohai.plugin(:Network) do
180
180
  else
181
181
  matches[:name]
182
182
  end
183
- Ohai::Log.debug("found interface device: #{network[:default_interface]} #{matches[:name]}")
183
+ Ohai::Log.debug("Plugin Network: found interface device: #{network[:default_interface]} #{matches[:name]}")
184
184
  end
185
185
  matches = /gateway: (\S+)/.match(line)
186
186
  if matches
187
- Ohai::Log.debug("found gateway: #{matches[1]}")
187
+ Ohai::Log.debug("Plugin Network: found gateway: #{matches[1]}")
188
188
  network[:default_gateway] = matches[1]
189
189
  end
190
190
  end
@@ -44,7 +44,7 @@ Ohai.plugin(:SSHHostKey) do
44
44
  # Darwin
45
45
  "/etc/sshd_config"
46
46
  else
47
- Ohai::Log.debug("Failed to find sshd configuration file")
47
+ Ohai::Log.debug("Plugin SSHHostKey: Failed to find sshd configuration file")
48
48
  nil
49
49
  end
50
50
 
@@ -40,7 +40,7 @@ Ohai.plugin(:Uptime) do
40
40
  return [usec, seconds_to_human(usec)]
41
41
  end
42
42
  end
43
- return [nil, nil]
43
+ [nil, nil]
44
44
  end
45
45
 
46
46
  collect_data(:darwin) do
@@ -1,6 +1,6 @@
1
1
  #
2
2
  # Author:: Jason J. W. Williams (williamsjj@digitar.com)
3
- # Copyright:: Copyright (c) 2011-2016 Chef Software, Inc.
3
+ # Copyright:: Copyright (c) 2011-2017 Chef Software, Inc.
4
4
  # License:: Apache License, Version 2.0
5
5
  #
6
6
  # Licensed under the Apache License, Version 2.0 (the "License");
@@ -18,42 +18,65 @@
18
18
 
19
19
  Ohai.plugin(:Zpools) do
20
20
  provides "zpools"
21
+ depends "platform_family"
21
22
 
22
- collect_data(:solaris2) do
23
- pools = Mash.new
23
+ # If zpool status doesn't know about a field it returns '-'.
24
+ # We don't want to fill a field with that
25
+ def sanitize_value(value)
26
+ value == "-" ? nil : value
27
+ end
24
28
 
29
+ def gather_pool_info
30
+ pools = Mash.new
25
31
  # Grab ZFS zpools overall health and attributes
26
32
  so = shell_out("zpool list -H -o name,size,alloc,free,cap,dedup,health,version")
27
33
  so.stdout.lines do |line|
28
34
  case line
29
35
  when /^([-_0-9A-Za-z]*)\s+([.0-9]+[MGTPE])\s+([.0-9]+[MGTPE])\s+([.0-9]+[MGTPE])\s+(\d+%)\s+([.0-9]+x)\s+([-_0-9A-Za-z]+)\s+(\d+|-)$/
36
+ Ohai::Log.debug("Plugin Zpools: Parsing zpool list line: #{line.chomp}")
30
37
  pools[$1] = Mash.new
31
- pools[$1][:pool_size] = $2
32
- pools[$1][:pool_allocated] = $3
33
- pools[$1][:pool_free] = $4
34
- pools[$1][:capacity_used] = $5
35
- pools[$1][:dedup_factor] = $6
36
- pools[$1][:health] = $7
37
- pools[$1][:zpool_version] = $8
38
+ pools[$1][:pool_size] = sanitize_value($2)
39
+ pools[$1][:pool_allocated] = sanitize_value($3)
40
+ pools[$1][:pool_free] = sanitize_value($4)
41
+ pools[$1][:capacity_used] = sanitize_value($5)
42
+ pools[$1][:dedup_factor] = sanitize_value($6)
43
+ pools[$1][:health] = sanitize_value($7)
44
+ pools[$1][:zpool_version] = sanitize_value($8)
38
45
  end
39
46
  end
47
+ pools
48
+ end
49
+
50
+ collect_data(:solaris2, :linux, :freebsd, :openbsd, :netbsd, :dragonflybsd) do
51
+ pools = gather_pool_info
40
52
 
41
53
  # Grab individual health for devices in the zpools
42
54
  pools.keys.each do |pool|
43
55
  pools[pool][:devices] = Mash.new
56
+
44
57
  # Run "zpool status" as non-root user (adm) so that
45
58
  # the command won't try to open() each device which can
46
59
  # hang the command if any of the disks are bad.
47
- so = shell_out("su adm -c \"zpool status #{pool}\"")
60
+ if platform_family == "solaris2"
61
+ command = "su adm -c \"zpool status #{pool}\""
62
+ else
63
+ command = "zpool status #{pool}"
64
+ end
65
+
66
+ so = shell_out(command)
48
67
  so.stdout.lines do |line|
49
68
  case line
50
- when /^\s+(c[-_a-zA-Z0-9]+)\s+([-_a-zA-Z0-9]+)\s+(\d+)\s+(\d+)\s+(\d+)$/
69
+ # linux: http://rubular.com/r/J3wQC6E2lH
70
+ # solaris: http://rubular.com/r/FqOBzUQQ4p
71
+ # freebsd: http://rubular.com/r/RYkMNlytXl
72
+ when /^\s+((sd|c|ad|da)[-_a-zA-Z0-9]+)\s+([-_a-zA-Z0-9]+)\s+(\d+)\s+(\d+)\s+(\d+)$/
73
+ Ohai::Log.debug("Plugin Zpools: Parsing zpool status line: #{line.chomp}")
51
74
  pools[pool][:devices][$1] = Mash.new
52
- pools[pool][:devices][$1][:state] = $2
75
+ pools[pool][:devices][$1][:state] = $3
53
76
  pools[pool][:devices][$1][:errors] = Mash.new
54
- pools[pool][:devices][$1][:errors][:read] = $3
55
- pools[pool][:devices][$1][:errors][:write] = $4
56
- pools[pool][:devices][$1][:errors][:checksum] = $5
77
+ pools[pool][:devices][$1][:errors][:read] = $4
78
+ pools[pool][:devices][$1][:errors][:write] = $5
79
+ pools[pool][:devices][$1][:errors][:checksum] = $6
57
80
  end
58
81
  end
59
82
  end
@@ -26,11 +26,11 @@ module Ohai
26
26
  paths.each do |path|
27
27
  filename = File.join(path, cmd)
28
28
  if File.executable?(filename)
29
- Ohai::Log.debug("Plugin #{self.name}: found #{cmd} at #{filename}")
29
+ Ohai::Log.debug("Plugin #{name}: found #{cmd} at #{filename}")
30
30
  return filename
31
31
  end
32
32
  end
33
- Ohai::Log.debug("Plugin #{self.name}: did not find #{cmd}")
33
+ Ohai::Log.debug("Plugin #{name}: did not find #{cmd}")
34
34
  false
35
35
  end
36
36
  end
@@ -18,5 +18,5 @@
18
18
 
19
19
  module Ohai
20
20
  OHAI_ROOT = File.expand_path(File.dirname(__FILE__))
21
- VERSION = "13.1.0"
21
+ VERSION = "13.2.0"
22
22
  end
@@ -47,3 +47,4 @@ devices.common.IBM.ethernet:devices.common.IBM.ethernet.rte:7.1.1.16: : :C:F:Com
47
47
  devices.common.IBM.fc:devices.common.IBM.fc.hba-api:7.1.1.16: : :C:F:Common HBA API Library: : : : : : :0:0:/:1228
48
48
  devices.common.IBM.fc:devices.common.IBM.fc.rte:7.1.1.16: : :C:F:Common IBM FC Software: : : : : : :0:0:/:1228
49
49
  devices.common.IBM.fda:devices.common.IBM.fda.diag:7.1.0.0: : :C: :Common Diskette Adapter and Device Diagnostics: : : : : : :0:0:/:1036
50
+ wget:wget-1.9.1-3:1.9.1-3: : :C:R:A utility for retrieving files using the HTTP or FTP protocols.: :/bin/rpm -e wget: : : : :0: :/opt/freeware:Wed Nov 5 01:37:09 MST 2014
@@ -21,17 +21,64 @@ require_relative "../../../spec_helper.rb"
21
21
  describe Ohai::System, "Darwin cpu plugin" do
22
22
  before(:each) do
23
23
  @plugin = get_plugin("darwin/cpu")
24
+ @stdout = <<-CTL
25
+ hw.ncpu: 8
26
+ hw.byteorder: 1234
27
+ hw.memsize: 17179869184
28
+ hw.activecpu: 8
29
+ hw.packages: 1
30
+ hw.tbfrequency: 1000000000
31
+ hw.l3cachesize: 6291456
32
+ hw.l2cachesize: 262144
33
+ hw.l1dcachesize: 32768
34
+ hw.l1icachesize: 32768
35
+ hw.cachelinesize: 64
36
+ hw.cpufrequency: 2800000000
37
+ hw.busfrequency: 100000000
38
+ hw.pagesize32: 4096
39
+ hw.pagesize: 4096
40
+ hw.cpufamily: 280134364
41
+ hw.cpu64bit_capable: 1
42
+ hw.cpusubtype: 8
43
+ hw.cputype: 7
44
+ hw.logicalcpu_max: 8
45
+ hw.logicalcpu: 8
46
+ hw.physicalcpu_max: 4
47
+ hw.physicalcpu: 4
48
+ hw.targettype: Mac
49
+ hw.cputhreadtype: 1
50
+ machdep.cpu.thread_count: 8
51
+ machdep.cpu.core_count: 4
52
+ machdep.cpu.address_bits.virtual: 48
53
+ machdep.cpu.address_bits.physical: 39
54
+ machdep.cpu.cache.size: 256
55
+ machdep.cpu.cache.L2_associativity: 8
56
+ machdep.cpu.cache.linesize: 64
57
+ machdep.cpu.processor_flag: 5
58
+ machdep.cpu.microcode_version: 15
59
+ machdep.cpu.cores_per_package: 8
60
+ machdep.cpu.logical_per_package: 16
61
+ machdep.cpu.extfeatures: SYSCALL XD 1GBPAGE EM64T LAHF LZCNT RDTSCP TSCI
62
+ machdep.cpu.leaf7_features: SMEP ERMS RDWRFSGS TSC_THREAD_OFFSET BMI1 HLE AVX2 BMI2 INVPCID RTM FPU_CSDS
63
+ machdep.cpu.features: FPU VME DE PSE TSC MSR PAE MCE CX8 APIC SEP MTRR PGE MCA CMOV PAT PSE36 CLFSH DS ACPI MMX FXSR SSE SSE2 SS HTT TM PBE SSE3 PCLMULQDQ DTES64 MON DSCPL VMX SMX EST TM2 SSSE3 FMA CX16 TPR PDCM SSE4.1 SSE4.2 x2APIC MOVBE POPCNT AES PCID XSAVE OSXSAVE SEGLIM64 TSCTMR AVX1.0 RDRAND F16C
64
+ machdep.cpu.brand: 0
65
+ machdep.cpu.signature: 263777
66
+ machdep.cpu.extfeature_bits: 142473169152
67
+ machdep.cpu.leaf7_feature_bits: 12219
68
+ machdep.cpu.feature_bits: 9221960262849657855
69
+ machdep.cpu.stepping: 1
70
+ machdep.cpu.extfamily: 0
71
+ machdep.cpu.extmodel: 4
72
+ machdep.cpu.model: 70
73
+ machdep.cpu.family: 6
74
+ machdep.cpu.brand_string: Intel(R) Core(TM) i7-4980HQ CPU @ 2.80GHz
75
+ machdep.cpu.vendor: GenuineIntel
76
+ machdep.cpu.max_ext: 2147483656
77
+ machdep.cpu.max_basic: 13
78
+ CTL
79
+
24
80
  allow(@plugin).to receive(:collect_os).and_return(:darwin)
25
- allow(@plugin).to receive(:shell_out).with("sysctl -n hw.packages").and_return(mock_shell_out(0, "1", ""))
26
- allow(@plugin).to receive(:shell_out).with("sysctl -n hw.physicalcpu").and_return(mock_shell_out(0, "4", ""))
27
- allow(@plugin).to receive(:shell_out).with("sysctl -n hw.logicalcpu").and_return(mock_shell_out(0, "8", ""))
28
- allow(@plugin).to receive(:shell_out).with("sysctl -n hw.cpufrequency").and_return(mock_shell_out(0, "2300000000", ""))
29
- allow(@plugin).to receive(:shell_out).with("sysctl -n machdep.cpu.vendor").and_return(mock_shell_out(0, "GenuineIntel\n", ""))
30
- allow(@plugin).to receive(:shell_out).with("sysctl -n machdep.cpu.brand_string").and_return(mock_shell_out(0, "Intel(R) Core(TM) i7-3615QM CPU @ 2.30GHz\n", ""))
31
- allow(@plugin).to receive(:shell_out).with("sysctl -n machdep.cpu.model").and_return(mock_shell_out(0, "58", ""))
32
- allow(@plugin).to receive(:shell_out).with("sysctl -n machdep.cpu.family").and_return(mock_shell_out(0, "6", ""))
33
- allow(@plugin).to receive(:shell_out).with("sysctl -n machdep.cpu.stepping").and_return(mock_shell_out(0, "9", ""))
34
- allow(@plugin).to receive(:shell_out).with("sysctl -n machdep.cpu.features").and_return(mock_shell_out(0, "FPU VME DE PSE TSC MSR PAE MCE CX8 APIC SEP MTRR PGE MCA CMOV PAT PSE36 CLFSH DS ACPI MMX FXSR SSE SSE2 SS HTT TM PBE SSE3 PCLMULQDQ DTES64 MON DSCPL VMX EST TM2 SSSE3 CX16 TPR PDCM SSE4.1 SSE4.2 x2APIC POPCNT AES PCID XSAVE OSXSAVE TSCTMR AVX1.0 RDRAND F16C", ""))
81
+ allow(@plugin).to receive(:shell_out).with("sysctl -a").and_return(mock_shell_out(0, @stdout, ""))
35
82
  @plugin.run
36
83
  end
37
84
 
@@ -47,31 +94,31 @@ describe Ohai::System, "Darwin cpu plugin" do
47
94
  expect(@plugin[:cpu][:real]).to eq(1)
48
95
  end
49
96
 
50
- it "should set cpu[:mhz] to 2300" do
51
- expect(@plugin[:cpu][:mhz]).to eq(2300)
97
+ it "should set cpu[:mhz] to 2800" do
98
+ expect(@plugin[:cpu][:mhz]).to eq(2800)
52
99
  end
53
100
 
54
101
  it "should set cpu[:vendor_id] to GenuineIntel" do
55
102
  expect(@plugin[:cpu][:vendor_id]).to eq("GenuineIntel")
56
103
  end
57
104
 
58
- it "should set cpu[:model_name] to Intel(R) Core(TM) i7-3615QM CPU @ 2.30GHz" do
59
- expect(@plugin[:cpu][:model_name]).to eq("Intel(R) Core(TM) i7-3615QM CPU @ 2.30GHz")
105
+ it "should set cpu[:model_name] to Intel(R) Core(TM) i7-4980HQ CPU @ 2.80GHz" do
106
+ expect(@plugin[:cpu][:model_name]).to eq("Intel(R) Core(TM) i7-4980HQ CPU @ 2.80GHz")
60
107
  end
61
108
 
62
- it "should set cpu[:model] to 58" do
63
- expect(@plugin[:cpu][:model]).to eq(58)
109
+ it "should set cpu[:model] to 70" do
110
+ expect(@plugin[:cpu][:model]).to eq(70)
64
111
  end
65
112
 
66
113
  it "should set cpu[:family] to 6" do
67
114
  expect(@plugin[:cpu][:family]).to eq(6)
68
115
  end
69
116
 
70
- it "should set cpu[:stepping] to 9" do
71
- expect(@plugin[:cpu][:stepping]).to eq(9)
117
+ it "should set cpu[:stepping] to 1" do
118
+ expect(@plugin[:cpu][:stepping]).to eq(1)
72
119
  end
73
120
 
74
121
  it "should set cpu[:flags] to array of flags" do
75
- expect(@plugin[:cpu][:flags]).to eq(["fpu", "vme", "de", "pse", "tsc", "msr", "pae", "mce", "cx8", "apic", "sep", "mtrr", "pge", "mca", "cmov", "pat", "pse36", "clfsh", "ds", "acpi", "mmx", "fxsr", "sse", "sse2", "ss", "htt", "tm", "pbe", "sse3", "pclmulqdq", "dtes64", "mon", "dscpl", "vmx", "est", "tm2", "ssse3", "cx16", "tpr", "pdcm", "sse4.1", "sse4.2", "x2apic", "popcnt", "aes", "pcid", "xsave", "osxsave", "tsctmr", "avx1.0", "rdrand", "f16c"])
122
+ expect(@plugin[:cpu][:flags]).to eq(["fpu", "vme", "de", "pse", "tsc", "msr", "pae", "mce", "cx8", "apic", "sep", "mtrr", "pge", "mca", "cmov", "pat", "pse36", "clfsh", "ds", "acpi", "mmx", "fxsr", "sse", "sse2", "ss", "htt", "tm", "pbe", "sse3", "pclmulqdq", "dtes64", "mon", "dscpl", "vmx", "smx", "est", "tm2", "ssse3", "fma", "cx16", "tpr", "pdcm", "sse4.1", "sse4.2", "x2apic", "movbe", "popcnt", "aes", "pcid", "xsave", "osxsave", "seglim64", "tsctmr", "avx1.0", "rdrand", "f16c"])
76
123
  end
77
124
  end