diff options
| author | Matt Robinson <matt@puppetlabs.com> | 2011-03-02 10:45:53 -0800 |
|---|---|---|
| committer | Matt Robinson <matt@puppetlabs.com> | 2011-03-02 10:45:53 -0800 |
| commit | 9571c99b6c8a1244e0cdda416a2e9ca0c52b25cb (patch) | |
| tree | eb7827afd6554cd276b2f6f0cbf79b4947f42570 /lib | |
| parent | e5cfac3cb90cbea688afdef4943d4f9dd49d8058 (diff) | |
| parent | 4e29f439189e0a40364724f50971c83652463085 (diff) | |
| download | puppet-9571c99b6c8a1244e0cdda416a2e9ca0c52b25cb.tar.gz puppet-9571c99b6c8a1244e0cdda416a2e9ca0c52b25cb.tar.xz puppet-9571c99b6c8a1244e0cdda416a2e9ca0c52b25cb.zip | |
Merge branch 'ticket/2.6.next/6541-md5_in_content_truncates' into 2.6.next
* ticket/2.6.next/6541-md5_in_content_truncates:
(#6541) maint: whitespace cleanup on the file integration spec
(#6541) Fix content with checksum truncation bug
Diffstat (limited to 'lib')
| -rwxr-xr-x | lib/puppet/type/file/content.rb | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/lib/puppet/type/file/content.rb b/lib/puppet/type/file/content.rb index 5223ee333..827183213 100755 --- a/lib/puppet/type/file/content.rb +++ b/lib/puppet/type/file/content.rb @@ -163,13 +163,15 @@ module Puppet Puppet.settings[:name] == "apply" end + # the content is munged so if it's a checksum source_or_content is nil + # unless the checksum indirectly comes from source def each_chunk_from(source_or_content) if source_or_content.is_a?(String) yield source_or_content - elsif source_or_content.nil? && resource.parameter(:ensure) && [:present, :file].include?(resource.parameter(:ensure).value) - yield '' - elsif source_or_content.nil? + elsif content_is_really_a_checksum? && source_or_content.nil? yield read_file_from_filebucket + elsif source_or_content.nil? + yield '' elsif self.class.standalone? yield source_or_content.content elsif source_or_content.local? @@ -181,6 +183,10 @@ module Puppet private + def content_is_really_a_checksum? + checksum?(should) + end + def chunk_file_from_disk(source_or_content) File.open(source_or_content.full_path, "r") do |src| while chunk = src.read(8192) |
