diff options
author | Theodore Nordsieck <theo@opscode.com> | 2013-09-05 16:08:53 -0700 |
---|---|---|
committer | Theodore Nordsieck <theo@opscode.com> | 2013-09-11 16:13:21 -0700 |
commit | b1c65734447bf82810897abec96efb8074aa5e60 (patch) | |
tree | 3cdd47b5e212944b06e161e587de4df1277fee2a | |
parent | 1158eb358fbbe67269852e3d6b62ab8ebfa0e7a7 (diff) | |
download | ohai-b1c65734447bf82810897abec96efb8074aa5e60.tar.gz |
Converted plugins/erlang to Mixlib::ShellOut
-rw-r--r-- | lib/ohai/plugins/erlang.rb | 7 | ||||
-rw-r--r-- | spec/unit/plugins/erlang_spec.rb | 8 |
2 files changed, 6 insertions, 9 deletions
diff --git a/lib/ohai/plugins/erlang.rb b/lib/ohai/plugins/erlang.rb index 2409a7e1..e398fc61 100644 --- a/lib/ohai/plugins/erlang.rb +++ b/lib/ohai/plugins/erlang.rb @@ -25,10 +25,9 @@ Ohai.plugin do output = nil erlang = Mash.new - status, stdout, stderr = run_command(:no_status_check => true, :command => "erl +V") - - if status == 0 - output = stderr.split + so = shell_out("erl +V") + if so.exitstatus == 0 + output = so.stderr.split if output.length >= 6 options = output[1] options.gsub!(/(\(|\))/, '') diff --git a/spec/unit/plugins/erlang_spec.rb b/spec/unit/plugins/erlang_spec.rb index d7878788..fc7a2cb1 100644 --- a/spec/unit/plugins/erlang_spec.rb +++ b/spec/unit/plugins/erlang_spec.rb @@ -26,14 +26,12 @@ describe Ohai::System, "plugin erlang" do before(:each) do @plugin = get_plugin("erlang") @plugin[:languages] = Mash.new - @status = 0 - @stdin = "" @stderr = "Erlang (ASYNC_THREADS,SMP,HIPE) (BEAM) emulator version 5.6.2\n" - @plugin.stub(:run_command).with({:no_status_check => true, :command => "erl +V"}).and_return([@status, @stdout, @stderr]) + @plugin.stub(:shell_out).with("erl +V").and_return(mock_shell_out(0, "", @stderr)) end it "should get the erlang version from erl +V" do - @plugin.should_receive(:run_command).with({:no_status_check => true, :command => "erl +V"}).and_return([0, "", "Erlang (ASYNC_THREADS,SMP,HIPE) (BEAM) emulator version 5.6.2\n"]) + @plugin.should_receive(:shell_out).with("erl +V").and_return(mock_shell_out(0, "", @stderr)) @plugin.run end @@ -56,7 +54,7 @@ describe Ohai::System, "plugin erlang" do @status = 1 @stdin = "" @stderr = "Erlang (ASYNC_THREADS,SMP,HIPE) (BEAM) emulator version 5.6.2\n" - @plugin.stub(:run_command).with({:no_status_check => true, :command => "erl +V"}).and_return([@status, @stdout, @stderr]) + @plugin.stub(:shell_out).with("erl +V").and_return(mock_shell_out(1, "", @stderr)) @plugin.run @plugin.languages.should_not have_key(:erlang) end |