[Pkg-puppet-devel] [facter] 263/352: (maint) Return the empty string on exec error
Stig Sandbeck Mathisen
ssm at debian.org
Sun Apr 6 22:21:51 UTC 2014
This is an automated email from the git hooks/post-receive script.
ssm pushed a commit to branch master
in repository facter.
commit 19382e4b8d6466897db02899e594717305bdf651
Author: Adrien Thebo <git at somethingsinistral.net>
Date: Fri Feb 14 12:12:35 2014 -0800
(maint) Return the empty string on exec error
Commit 8a14998 removed most of the special casing around executing
commands and changed calling code to always assume that .exec would
return a string. However the error cases in .exec would still return
nil which would break this assumption.
This commit updates .exec to return the empty string on error. It's
somewhat questionable to do this but if we want to fail hard on errors
we should raise an exception instead of returning nil.
---
lib/facter/core/execution.rb | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/lib/facter/core/execution.rb b/lib/facter/core/execution.rb
index 3b99486..8d5916d 100644
--- a/lib/facter/core/execution.rb
+++ b/lib/facter/core/execution.rb
@@ -165,7 +165,7 @@ module Facter
# if we can find the binary, we'll run the command with the expanded path to the binary
code = expanded_code
else
- return nil
+ return ''
end
out = ''
@@ -174,7 +174,7 @@ module Facter
out = %x{#{code}}.chomp
rescue => detail
Facter.warn(detail)
- return nil
+ return ''
end
out
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-puppet/facter.git
More information about the Pkg-puppet-devel
mailing list