From c6f6b6639c6793e441d3b27a2188895cd3afb903 Mon Sep 17 00:00:00 2001 From: Seth Chisamore Date: Tue, 30 Sep 2014 15:35:41 -0700 Subject: Ensure CPU total is an integer on FreeBSD This matches the behavior on other platforms. --- lib/ohai/plugins/freebsd/cpu.rb | 2 +- spec/unit/plugins/freebsd/cpu_spec.rb | 2 +- 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 -- cgit v1.2.1