diff options
| author | Jesse Wolfe <jes5199@gmail.com> | 2010-12-16 14:10:20 -0800 |
|---|---|---|
| committer | Jesse Wolfe <jes5199@gmail.com> | 2010-12-16 14:34:56 -0800 |
| commit | e99a3ea6fc2b30ed7bcbd3c1bc011b38d92f57b2 (patch) | |
| tree | 4ac0978edcb7c7b10ea2cd6209f500a19a65cba4 /lib | |
| parent | 3f9f37984d1ac5f3ddcc83bf2b1facdb6df6dacd (diff) | |
| download | puppet-e99a3ea6fc2b30ed7bcbd3c1bc011b38d92f57b2.tar.gz puppet-e99a3ea6fc2b30ed7bcbd3c1bc011b38d92f57b2.tar.xz puppet-e99a3ea6fc2b30ed7bcbd3c1bc011b38d92f57b2.zip | |
Fix #5566 none, mtime, and ctime checksum types can write file contents
The #write method in lib/puppet/type/file/content.rb relies on the block
passed to #sum_stream getting executed. "none", "mtime", and "ctime"
aren't real checksums, so they violated that assumption and just
returned empty results. This patch causes that block to get executed.
Diffstat (limited to 'lib')
| -rw-r--r-- | lib/puppet/util/checksums.rb | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/lib/puppet/util/checksums.rb b/lib/puppet/util/checksums.rb index 5aebd8392..6fdf14ecf 100644 --- a/lib/puppet/util/checksums.rb +++ b/lib/puppet/util/checksums.rb @@ -1,6 +1,12 @@ # A stand-alone module for calculating checksums # in a generic way. module Puppet::Util::Checksums + class FakeChecksum + def <<(*args) + self + end + end + # Is the provided string a checksum? def checksum?(string) string =~ /^\{(\w{3,5})\}\S+/ @@ -55,7 +61,10 @@ module Puppet::Util::Checksums end # by definition this doesn't exist + # but we still need to execute the block given def mtime_stream + noop_digest = FakeChecksum.new + yield noop_digest nil end @@ -105,6 +114,8 @@ module Puppet::Util::Checksums end def none_stream + noop_digest = FakeChecksum.new + yield noop_digest "" end |
