This patch prevents stdout and stderr from being combined by 
Puppet::Util.execute, when used by Puppet::Indirector::Exec for external nodes.

Signed-off-by: Oliver Hookins <[email protected]>
---
 lib/puppet/indirector/exec.rb          |    6 +++---
 spec/unit/indirector/exec_spec.rb      |    8 ++++----
 spec/unit/indirector/node/exec_spec.rb |    2 +-
 3 files changed, 8 insertions(+), 8 deletions(-)

diff --git a/lib/puppet/indirector/exec.rb b/lib/puppet/indirector/exec.rb
index 4683eda..8ea13ff 100644
--- a/lib/puppet/indirector/exec.rb
+++ b/lib/puppet/indirector/exec.rb
@@ -16,8 +16,8 @@ class Puppet::Indirector::Exec < Puppet::Indirector::Terminus
   private
 
   # Proxy the execution, so it's easier to test.
-  def execute(command)
-    Puppet::Util.execute(command)
+  def execute(command, arguments)
+    Puppet::Util.execute(command,arguments)
   end
 
   # Call the external command and see if it returns our output.
@@ -33,7 +33,7 @@ class Puppet::Indirector::Exec < Puppet::Indirector::Terminus
     # Add our name to it.
     external_command << name
     begin
-      output = execute(external_command)
+      output = execute(external_command, :combine => false)
     rescue Puppet::ExecutionFailure => detail
       raise Puppet::Error, "Failed to find #{name} via exec: #{detail}"
     end
diff --git a/spec/unit/indirector/exec_spec.rb 
b/spec/unit/indirector/exec_spec.rb
index de37f27..89d91a3 100755
--- a/spec/unit/indirector/exec_spec.rb
+++ b/spec/unit/indirector/exec_spec.rb
@@ -33,22 +33,22 @@ describe Puppet::Indirector::Exec do
   end
 
   it "should execute the command with the object name as the only argument" do
-    @searcher.expects(:execute).with(%w{/echo foo})
+    @searcher.expects(:execute).with(%w{/echo foo}, :combine => false)
     @searcher.find(@request)
   end
 
   it "should return the output of the script" do
-    @searcher.expects(:execute).with(%w{/echo foo}).returns("whatever")
+    @searcher.expects(:execute).with(%w{/echo foo}, :combine => 
false).returns("whatever")
     @searcher.find(@request).should == "whatever"
   end
 
   it "should return nil when the command produces no output" do
-    @searcher.expects(:execute).with(%w{/echo foo}).returns(nil)
+    @searcher.expects(:execute).with(%w{/echo foo}, :combine => 
false).returns(nil)
     @searcher.find(@request).should be_nil
   end
 
   it "should raise an exception if there's an execution failure" do
-    @searcher.expects(:execute).with(%w{/echo 
foo}).raises(Puppet::ExecutionFailure.new("message"))
+    @searcher.expects(:execute).with(%w{/echo foo}, :combine => 
false).raises(Puppet::ExecutionFailure.new("message"))
 
     lambda {@searcher.find(@request)}.should raise_exception(Puppet::Error, 
'Failed to find foo via exec: message')
   end
diff --git a/spec/unit/indirector/node/exec_spec.rb 
b/spec/unit/indirector/node/exec_spec.rb
index d214a5e..ebf28bd 100755
--- a/spec/unit/indirector/node/exec_spec.rb
+++ b/spec/unit/indirector/node/exec_spec.rb
@@ -32,7 +32,7 @@ describe Puppet::Node::Exec do
       @result = {}
       # Use a local variable so the reference is usable in the execute 
definition.
       result = @result
-      @searcher.meta_def(:execute) do |command|
+      @searcher.meta_def(:execute) do |command, arguments|
         return YAML.dump(result)
       end
 
-- 
1.7.1

-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Developers" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/puppet-dev?hl=en.

Reply via email to