diff options
-rw-r--r-- | lib/ohai/plugins/darwin/cpu.rb | 4 | ||||
-rw-r--r-- | spec/unit/plugins/darwin/cpu_spec.rb | 4 |
2 files changed, 4 insertions, 4 deletions
diff --git a/lib/ohai/plugins/darwin/cpu.rb b/lib/ohai/plugins/darwin/cpu.rb index a0c90532..d8210c9d 100644 --- a/lib/ohai/plugins/darwin/cpu.rb +++ b/lib/ohai/plugins/darwin/cpu.rb @@ -1,7 +1,7 @@ # # Author:: Nathan L Smith (<nlloyds@gmail.com>) # Author:: Tim Smith (<tsmith@chef.io>) -# Copyright:: Copyright (c) 2013-2016 Chef Software, Inc. +# Copyright:: Copyright (c) 2013-2018 Chef Software, Inc. # License:: Apache License, Version 2.0 # # Licensed under the Apache License, Version 2.0 (the "License"); @@ -22,7 +22,7 @@ Ohai.plugin(:CPU) do collect_data(:darwin) do cpu Mash.new - shell_out("sysctl -a").stdout.lines.each do |line| + shell_out("sysctl hw machdep").stdout.lines.each do |line| case line when /^hw.packages: (.*)$/ cpu[:real] = Regexp.last_match[1].to_i diff --git a/spec/unit/plugins/darwin/cpu_spec.rb b/spec/unit/plugins/darwin/cpu_spec.rb index 1ad65e30..8743283e 100644 --- a/spec/unit/plugins/darwin/cpu_spec.rb +++ b/spec/unit/plugins/darwin/cpu_spec.rb @@ -1,6 +1,6 @@ # # Author:: Nathan L Smith (<nlloyds@gmail.com>) -# Copyright:: Copyright (c) 2013-2016 Chef Software, Inc. +# Copyright:: Copyright (c) 2013-2018 Chef Software, Inc. # License:: Apache License, Version 2.0 # # Licensed under the Apache License, Version 2.0 (the "License"); @@ -78,7 +78,7 @@ describe Ohai::System, "Darwin cpu plugin" do CTL allow(@plugin).to receive(:collect_os).and_return(:darwin) - allow(@plugin).to receive(:shell_out).with("sysctl -a").and_return(mock_shell_out(0, @stdout, "")) + allow(@plugin).to receive(:shell_out).with("sysctl hw machdep").and_return(mock_shell_out(0, @stdout, "")) @plugin.run end |