summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTheodore Nordsieck <theo@opscode.com>2013-09-09 19:13:20 -0700
committerTheodore Nordsieck <theo@opscode.com>2013-09-11 16:13:24 -0700
commitcb095cdf187b0835c18f5dd1d7d1e31bbd1ee444 (patch)
tree9aab1310f0906a71b9d74dbff36a44e692aa58a2
parent95c6c1caf33937750a36b3f49ac72e236e938bd5 (diff)
downloadohai-cb095cdf187b0835c18f5dd1d7d1e31bbd1ee444.tar.gz
Converted plugins/netbsd/platform to Mixlib::ShellOut.
-rw-r--r--lib/ohai/plugins/netbsd/platform.rb6
-rw-r--r--spec/unit/plugins/netbsd/platform_spec.rb4
2 files changed, 6 insertions, 4 deletions
diff --git a/lib/ohai/plugins/netbsd/platform.rb b/lib/ohai/plugins/netbsd/platform.rb
index 6f147950..0bfaee77 100644
--- a/lib/ohai/plugins/netbsd/platform.rb
+++ b/lib/ohai/plugins/netbsd/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/netbsd/platform_spec.rb b/spec/unit/plugins/netbsd/platform_spec.rb
index 1c9429c6..4397d100 100644
--- a/spec/unit/plugins/netbsd/platform_spec.rb
+++ b/spec/unit/plugins/netbsd/platform_spec.rb
@@ -22,8 +22,8 @@ require File.expand_path(File.dirname(__FILE__) + '/../../../spec_helper.rb')
describe Ohai::System, "NetBSD plugin platform" do
before(:each) do
@plugin = get_plugin("netbsd/platform")
- @plugin.stub(:from).with("uname -s").and_return("NetBSD")
- @plugin.stub(:from).with("uname -r").and_return("4.5")
+ @plugin.stub(:shell_out).with("uname -s").and_return(mock_shell_out(0, "NetBSD\n", ""))
+ @plugin.stub(:shell_out).with("uname -r").and_return(mock_shell_out(0, "4.5\n", ""))
@plugin[:os] = "netbsd"
end