From f911d95c3b7fb9cf6c347703dcfc88465041b0af Mon Sep 17 00:00:00 2001 From: Tom Duffield Date: Fri, 2 Dec 2016 17:34:54 -0600 Subject: Use name for Windows CPU model_name Use the "name" value for the model_name, and move description to the description field. Signed-off-by: Tom Duffield --- lib/ohai/plugins/windows/cpu.rb | 3 ++- spec/unit/plugins/windows/cpu_spec.rb | 9 ++++++++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/lib/ohai/plugins/windows/cpu.rb b/lib/ohai/plugins/windows/cpu.rb index ccb29c86..e8ad9138 100644 --- a/lib/ohai/plugins/windows/cpu.rb +++ b/lib/ohai/plugins/windows/cpu.rb @@ -60,7 +60,8 @@ Ohai.plugin(:CPU) do processor["stepping"] end cpu[current_cpu]["physical_id"] = processor["deviceid"] - cpu[current_cpu]["model_name"] = processor["description"] + cpu[current_cpu]["model_name"] = processor["name"] + cpu[current_cpu]["description"] = processor["description"] cpu[current_cpu]["mhz"] = processor["maxclockspeed"].to_s cpu[current_cpu]["cache_size"] = "#{processor['l2cachesize']} KB" end diff --git a/spec/unit/plugins/windows/cpu_spec.rb b/spec/unit/plugins/windows/cpu_spec.rb index 313104bf..b4393e82 100644 --- a/spec/unit/plugins/windows/cpu_spec.rb +++ b/spec/unit/plugins/windows/cpu_spec.rb @@ -32,8 +32,13 @@ shared_examples "a cpu" do |cpu_no| expect(@plugin[:cpu]["#{cpu_no}"][:vendor_id]).to eq("GenuineIntel") end - it "should set model_name to Intel64 Family 6 Model 70 Stepping 1" do + it "should set model_name to Intel(R) Core(TM) i7-4500U CPU @ 1.80GHz" do expect(@plugin[:cpu]["#{cpu_no}"][:model_name]) + .to eq("Intel(R) Core(TM) i7-4500U CPU @ 1.80GHz") + end + + it "should set description to Intel64 Family 6 Model 70 Stepping 1" do + expect(@plugin[:cpu]["#{cpu_no}"][:description]) .to eq("Intel64 Family 6 Model 70 Stepping 1") end @@ -64,6 +69,7 @@ describe Ohai::System, "Windows cpu plugin" do @double_wmi_instance = instance_double(WmiLite::Wmi) @processors = [{ "description" => "Intel64 Family 6 Model 70 Stepping 1", + "name" => "Intel(R) Core(TM) i7-4500U CPU @ 1.80GHz", "deviceid" => "CPU0", "family" => 2, "manufacturer" => "GenuineIntel", @@ -75,6 +81,7 @@ describe Ohai::System, "Windows cpu plugin" do "l2cachesize" => 64 }, { "description" => "Intel64 Family 6 Model 70 Stepping 1", + "name" => "Intel(R) Core(TM) i7-4500U CPU @ 1.80GHz", "deviceid" => "CPU1", "family" => 2, "manufacturer" => "GenuineIntel", -- cgit v1.2.1