summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTom Duffield <tom@chef.io>2016-12-02 17:34:54 -0600
committerTom Duffield <tom@chef.io>2016-12-02 17:34:54 -0600
commitf911d95c3b7fb9cf6c347703dcfc88465041b0af (patch)
treec0f153a33341da093254079f14805f9122ee4799
parent829165ce577d472fe58b835f8c371e8c50ac43a1 (diff)
downloadohai-COOL-626/tduffield/use-cpu-name-for-model-name-windows.tar.gz
Use the "name" value for the model_name, and move description to the description field. Signed-off-by: Tom Duffield <tom@chef.io>
-rw-r--r--lib/ohai/plugins/windows/cpu.rb3
-rw-r--r--spec/unit/plugins/windows/cpu_spec.rb9
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",