diff options
author | Seth Chisamore <schisamo@getchef.com> | 2014-10-01 00:48:12 -0700 |
---|---|---|
committer | Seth Chisamore <schisamo@getchef.com> | 2014-10-01 00:48:12 -0700 |
commit | 1e8510fae9d1a07360f9e4870acb903a072f7a48 (patch) | |
tree | 98f65e7a88ae2ca1a7c7f806c9a30a5b95bd0c4b | |
parent | 70d7535cffbee2ba360dfd2bf97d031a988bca48 (diff) | |
parent | c6f6b6639c6793e441d3b27a2188895cd3afb903 (diff) | |
download | ohai-1e8510fae9d1a07360f9e4870acb903a072f7a48.tar.gz |
Merge pull request #421 from opscode/schisamo/freebsd-cpu-total-fix
Ensure CPU total is an integer on FreeBSD
-rw-r--r-- | lib/ohai/plugins/freebsd/cpu.rb | 2 | ||||
-rw-r--r-- | 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 |