summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTheodore Nordsieck <theo@opscode.com>2013-09-10 09:47:35 -0700
committerTheodore Nordsieck <theo@opscode.com>2013-09-11 16:13:25 -0700
commit1c8651b16cb46a84dd01e06ad1c685635e7ae4cc (patch)
treeb00978ef07429d7db002c6cc118df2546079d5d6
parente7c022783c8e2897abbdcb23593677ff102c2cab (diff)
downloadohai-1c8651b16cb46a84dd01e06ad1c685635e7ae4cc.tar.gz
Converted plugins/freebsd/platform to Mixlib::ShellOut.
-rw-r--r--lib/ohai/plugins/freebsd/platform.rb6
-rw-r--r--spec/unit/plugins/freebsd/platform_spec.rb4
2 files changed, 6 insertions, 4 deletions
diff --git a/lib/ohai/plugins/freebsd/platform.rb b/lib/ohai/plugins/freebsd/platform.rb
index 6f147950..0bfaee77 100644
--- a/lib/ohai/plugins/freebsd/platform.rb
+++ b/lib/ohai/plugins/freebsd/platform.rb
@@ -20,7 +20,9 @@ Ohai.plugin do
provides "platform", "platform_version"
collect_data do
- platform from("uname -s").downcase
- platform_version from("uname -r")
+ so = shell_out("uname -s")
+ platform so.stdout.split($/)[0].downcase
+ so = shell_out("uname -r")
+ platform_version so.stdout.split($/)[0]
end
end
diff --git a/spec/unit/plugins/freebsd/platform_spec.rb b/spec/unit/plugins/freebsd/platform_spec.rb
index 76dadb98..798b1063 100644
--- a/spec/unit/plugins/freebsd/platform_spec.rb
+++ b/spec/unit/plugins/freebsd/platform_spec.rb
@@ -22,8 +22,8 @@ require File.expand_path(File.dirname(__FILE__) + '/../../../spec_helper.rb')
describe Ohai::System, "FreeBSD plugin platform" do
before(:each) do
@plugin = get_plugin("freebsd/platform")
- @plugin.stub(:from).with("uname -s").and_return("FreeBSD")
- @plugin.stub(:from).with("uname -r").and_return("7.1")
+ @plugin.stub(:shell_out).with("uname -s").and_return(mock_shell_out(0, "FreeBSD\n", ""))
+ @plugin.stub(:shell_out).with("uname -r").and_return(mock_shell_out(0, "7.1\n", ""))
@plugin[:os] = "freebsd"
end