summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTheodore Nordsieck <theo@opscode.com>2013-09-09 20:25:01 -0700
committerTheodore Nordsieck <theo@opscode.com>2013-09-11 16:13:24 -0700
commit8ffee1aa28cad4f96d4785cabe3bf4fbcb4851f2 (patch)
tree7dcca2f933ff86243605e41a19f24e452aaa829e
parent679791e859e98bb76253b6b2cb7159e5b7b06ed0 (diff)
downloadohai-8ffee1aa28cad4f96d4785cabe3bf4fbcb4851f2.tar.gz
Converted plugins/openbsd/hostname to Mixlib::ShellOut.
-rw-r--r--lib/ohai/plugins/openbsd/hostname.rb6
-rw-r--r--spec/unit/plugins/openbsd/hostname_spec.rb4
2 files changed, 6 insertions, 4 deletions
diff --git a/lib/ohai/plugins/openbsd/hostname.rb b/lib/ohai/plugins/openbsd/hostname.rb
index 98f1a09c..2a07bd76 100644
--- a/lib/ohai/plugins/openbsd/hostname.rb
+++ b/lib/ohai/plugins/openbsd/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/openbsd/hostname_spec.rb b/spec/unit/plugins/openbsd/hostname_spec.rb
index 895061a8..e7a4b207 100644
--- a/spec/unit/plugins/openbsd/hostname_spec.rb
+++ b/spec/unit/plugins/openbsd/hostname_spec.rb
@@ -23,8 +23,8 @@ describe Ohai::System, "OpenBSD hostname plugin" do
before(:each) do
@plugin = get_plugin("openbsd/hostname")
@plugin[:os] = "openbsd"
- @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", ""))
+ @plugin.stub(:shell_out).with("hostname").and_return(mock_shell_out(0, "katie.bethell", ""))
end
it_should_check_from("openbsd::hostname", "hostname", "hostname -s", "katie")