Signed-off-by: Luke Kanies <[email protected]>
---
lib/puppet/indirector/exec.rb | 6 +-----
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 2462e31..5b51142 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 e474de8..4a7e2b5 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
--
1.6.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
-~----------~----~----~----~------~----~------~--~---