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.
Signed-off-by: Markus Roberts <[email protected]> --- lib/puppet/type/file/content.rb | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/lib/puppet/type/file/content.rb b/lib/puppet/type/file/content.rb index 36e6c41..032c7c8 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 -- 1.6.4 -- 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.
