summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSeth Chisamore <schisamo@getchef.com>2014-09-30 15:35:41 -0700
committerSeth Chisamore <schisamo@getchef.com>2014-09-30 15:35:41 -0700
commitc6f6b6639c6793e441d3b27a2188895cd3afb903 (patch)
tree98f65e7a88ae2ca1a7c7f806c9a30a5b95bd0c4b
parent70d7535cffbee2ba360dfd2bf97d031a988bca48 (diff)
downloadohai-schisamo/freebsd-cpu-total-fix.tar.gz
Ensure CPU total is an integer on FreeBSDschisamo/freebsd-cpu-total-fix
This matches the behavior on other platforms.
-rw-r--r--lib/ohai/plugins/freebsd/cpu.rb2
-rw-r--r--spec/unit/plugins/freebsd/cpu_spec.rb2
2 files changed, 2 insertions, 2 deletions
diff --git a/lib/ohai/plugins/freebsd/cpu.rb b/lib/ohai/plugins/freebsd/cpu.rb
index 8355ec02..88baf2b5 100644
--- a/lib/ohai/plugins/freebsd/cpu.rb
+++ b/lib/ohai/plugins/freebsd/cpu.rb
@@ -55,6 +55,6 @@ Ohai.plugin(:CPU) do
cpu cpuinfo
so = shell_out("sysctl -n hw.ncpu")
- cpu[:total] = so.stdout.split($/)[0]
+ cpu[:total] = so.stdout.split($/)[0].to_i
end
end
diff --git a/spec/unit/plugins/freebsd/cpu_spec.rb b/spec/unit/plugins/freebsd/cpu_spec.rb
index 100c95f3..c988d897 100644
--- a/spec/unit/plugins/freebsd/cpu_spec.rb
+++ b/spec/unit/plugins/freebsd/cpu_spec.rb
@@ -62,7 +62,7 @@ describe Ohai::System, "FreeBSD cpu plugin" do
it "detects all CPU total" do
@plugin.run
- @plugin[:cpu][:total].should == "2"
+ @plugin[:cpu][:total].should == 2
end
end