summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatt Robinson <matt@puppetlabs.com>2011-03-18 16:18:04 -0700
committerMatt Robinson <matt@puppetlabs.com>2011-03-18 16:18:04 -0700
commit696ba50accc6a5b99180d5284ea729107daec080 (patch)
treebce81d3a6a1de19529f82e881f624668dfa4a82f
parentfa2010b13835e6d0a4a624def24dcf1f22f6a411 (diff)
parentdf20513122354deccd4ee4477a15cb70c5d605c6 (diff)
downloadpuppet-696ba50accc6a5b99180d5284ea729107daec080.tar.gz
puppet-696ba50accc6a5b99180d5284ea729107daec080.tar.xz
puppet-696ba50accc6a5b99180d5284ea729107daec080.zip
Merge branch 'ticket/2.6.next/6658' into 2.6.next
* ticket/2.6.next/6658: (#6658) Propagate ENC connection errors to the agent
-rw-r--r--lib/puppet/indirector/exec.rb3
-rwxr-xr-xspec/unit/indirector/exec_spec.rb5
2 files changed, 3 insertions, 5 deletions
diff --git a/lib/puppet/indirector/exec.rb b/lib/puppet/indirector/exec.rb
index fa789442b..4683eda0f 100644
--- a/lib/puppet/indirector/exec.rb
+++ b/lib/puppet/indirector/exec.rb
@@ -35,8 +35,7 @@ class Puppet::Indirector::Exec < Puppet::Indirector::Terminus
begin
output = execute(external_command)
rescue Puppet::ExecutionFailure => detail
- Puppet.err "Failed to find #{name} via exec: #{detail}"
- return nil
+ raise Puppet::Error, "Failed to find #{name} via exec: #{detail}"
end
if output =~ /\A\s*\Z/ # all whitespace
diff --git a/spec/unit/indirector/exec_spec.rb b/spec/unit/indirector/exec_spec.rb
index acad1ea93..de37f2775 100755
--- a/spec/unit/indirector/exec_spec.rb
+++ b/spec/unit/indirector/exec_spec.rb
@@ -47,10 +47,9 @@ describe Puppet::Indirector::Exec do
@searcher.find(@request).should be_nil
end
- it "should return nil and log an error if there's an execution failure" do
+ it "should raise an exception if there's an execution failure" do
@searcher.expects(:execute).with(%w{/echo foo}).raises(Puppet::ExecutionFailure.new("message"))
- Puppet.expects(:err)
- @searcher.find(@request).should be_nil
+ lambda {@searcher.find(@request)}.should raise_exception(Puppet::Error, 'Failed to find foo via exec: message')
end
end