summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTheodore Nordsieck <theo@opscode.com>2013-09-09 18:38:22 -0700
committerTheodore Nordsieck <theo@opscode.com>2013-09-11 16:13:23 -0700
commit553b8567b1263a018712f92f6b46619d70285cbf (patch)
treeac4ddd5b539315dc5dd4d9fb74ada2f08de4ec31
parent4f858a0e9ab4934afc408682a9882c48e291552b (diff)
downloadohai-553b8567b1263a018712f92f6b46619d70285cbf.tar.gz
Converted plugins/netbsd/hostname to Mixlib::ShellOut.
-rw-r--r--lib/ohai/plugins/netbsd/hostname.rb6
-rw-r--r--spec/unit/plugins/netbsd/hostname_spec.rb4
2 files changed, 6 insertions, 4 deletions
diff --git a/lib/ohai/plugins/netbsd/hostname.rb b/lib/ohai/plugins/netbsd/hostname.rb
index 98f1a09c..2a07bd76 100644
--- a/lib/ohai/plugins/netbsd/hostname.rb
+++ b/lib/ohai/plugins/netbsd/hostname.rb
@@ -20,7 +20,9 @@ Ohai.plugin do
provides "hostname", "fqdn"
collect_data do
- hostname from("hostname -s")
- fqdn from("hostname")
+ so = shell_out("hostname -s")
+ hostname so.stdout.split($/)[0]
+ so = shell_out("hostname")
+ fqdn so.stdout.split($/)[0]
end
end
diff --git a/spec/unit/plugins/netbsd/hostname_spec.rb b/spec/unit/plugins/netbsd/hostname_spec.rb
index e6744f83..3c8bd6c6 100644
--- a/spec/unit/plugins/netbsd/hostname_spec.rb
+++ b/spec/unit/plugins/netbsd/hostname_spec.rb
@@ -23,8 +23,8 @@ describe Ohai::System, "NetBSD hostname plugin" do
before(:each) do
@plugin = get_plugin("netbsd/hostname")
@plugin[:os] = "netbsd"
- @plugin.stub(:from).with("hostname -s").and_return("katie")
- @plugin.stub(:from).with("hostname").and_return("katie.bethell")
+ @plugin.stub(:shell_out).with("hostname -s").and_return(mock_shell_out(0, "katie\n", ""))
+ @plugin.stub(:shell_out).with("hostname").and_return(mock_shell_out(0, "katie.bethell", ""))
end
it_should_check_from("netbsd::hostname", "hostname", "hostname -s", "katie")