summaryrefslogtreecommitdiffstats
path: root/lib/puppet
diff options
context:
space:
mode:
authorMarkus Roberts <Markus@reality.com>2009-12-29 11:14:44 -0800
committerMarkus Roberts <Markus@reality.com>2009-12-29 11:14:44 -0800
commitd1ff4b3fca31ee99276c26bc1df6391cfc79254a (patch)
tree71bccee1ce6fcac587b05486dc4d7dfd85f91fb3 /lib/puppet
parent4d815117672a6f27ff368c9485edb4edf49e63aa (diff)
downloadpuppet-d1ff4b3fca31ee99276c26bc1df6391cfc79254a.tar.gz
puppet-d1ff4b3fca31ee99276c26bc1df6391cfc79254a.tar.xz
puppet-d1ff4b3fca31ee99276c26bc1df6391cfc79254a.zip
Fix for #2994 (undefined method "_file" message)
Attempting to call a constructed method name with a nil component (the checksum type in this case) causes an unhelpful error message in a case where either 1) the results were not needed anyway or 2) a more useful error message would otherwise be generated. It also opens (at least hypothetically) then possibility that some unrelated method (in this case "_file" would be called if it existed.
Diffstat (limited to 'lib/puppet')
-rwxr-xr-xlib/puppet/type/file/content.rb2
1 files changed, 1 insertions, 1 deletions
diff --git a/lib/puppet/type/file/content.rb b/lib/puppet/type/file/content.rb
index 36e6c4172..032c7c839 100755
--- a/lib/puppet/type/file/content.rb
+++ b/lib/puppet/type/file/content.rb
@@ -116,7 +116,7 @@ module Puppet
return :absent unless stat = @resource.stat
ftype = stat.ftype
# Don't even try to manage the content on directories or links
- return nil if ["directory","link"].include? ftype
+ return nil if ["directory","link"].include? ftype or checksum_type.nil?
begin
"{#{checksum_type}}" + send(checksum_type.to_s + "_file", resource[:path]).to_s