diff options
author | Luke Kanies <luke@madstop.com> | 2009-05-27 10:35:21 -0500 |
---|---|---|
committer | James Turnbull <james@lovedthanlost.net> | 2009-05-28 07:02:47 +1000 |
commit | e3d4c8e3873f287412d29701ff774e61a247c6d4 (patch) | |
tree | f17f5039385bcf159ad01778aa6b486b5c518472 | |
parent | bc1445b5cefb5742ca906632cc99a82a769ead97 (diff) | |
download | puppet-e3d4c8e3873f287412d29701ff774e61a247c6d4.tar.gz puppet-e3d4c8e3873f287412d29701ff774e61a247c6d4.tar.xz puppet-e3d4c8e3873f287412d29701ff774e61a247c6d4.zip |
Fixing #2240 - external node failures now log output
Signed-off-by: Luke Kanies <luke@madstop.com>
-rw-r--r-- | lib/puppet/indirector/exec.rb | 6 | ||||
-rwxr-xr-x | spec/unit/indirector/exec.rb | 7 |
2 files changed, 7 insertions, 6 deletions
diff --git a/lib/puppet/indirector/exec.rb b/lib/puppet/indirector/exec.rb index 2462e31da..5b51142c3 100644 --- a/lib/puppet/indirector/exec.rb +++ b/lib/puppet/indirector/exec.rb @@ -39,11 +39,7 @@ class Puppet::Indirector::Exec < Puppet::Indirector::Terminus begin output = execute(external_command) rescue Puppet::ExecutionFailure => detail - if $?.exitstatus == 1 - return nil - else - Puppet.err "Could not retrieve external node information for %s: %s" % [name, detail] - end + Puppet.err "Failed to find %s via exec: %s" % [name, detail] return nil end diff --git a/spec/unit/indirector/exec.rb b/spec/unit/indirector/exec.rb index e474de8b9..4a7e2b50e 100755 --- a/spec/unit/indirector/exec.rb +++ b/spec/unit/indirector/exec.rb @@ -47,5 +47,10 @@ describe Puppet::Indirector::Exec do @searcher.find(@request).should be_nil end - it "should be able to execute commands with multiple arguments" + it "should return nil and log an error 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 + end end |