summaryrefslogtreecommitdiffstats
path: root/lib/puppet/util
diff options
context:
space:
mode:
authorJacob Helwig <jacob@puppetlabs.com>2011-02-01 14:43:47 -0800
committerJacob Helwig <jacob@puppetlabs.com>2011-02-01 14:57:13 -0800
commit76788f80aab15e5ef6487788132b87ecc6ddd9ac (patch)
tree4eec377de6bd844013ee196b0a2091d245751c2d /lib/puppet/util
parentd6572921832cc0df22e13d55c3bc090b74155b91 (diff)
downloadpuppet-76788f80aab15e5ef6487788132b87ecc6ddd9ac.tar.gz
puppet-76788f80aab15e5ef6487788132b87ecc6ddd9ac.tar.xz
puppet-76788f80aab15e5ef6487788132b87ecc6ddd9ac.zip
(#5566) Treat source only File checksums as syntax errors when used with content
Certain checksum types (ctime, mtime) only make sense when used with the 'source' File parameter, since there is no way to check them on raw strings. Given the limitations of the current checksumming implementations, it is likely to introduce unexpected behavior when using the 'none' checksum type and either one of the 'source', and 'content' File parameters. Because of this, it is now a syntax error to use a checksum of 'none' with either parameter. Paired-with: Jesse Wolfe <jesse@puppetlabs.com>
Diffstat (limited to 'lib/puppet/util')
-rw-r--r--lib/puppet/util/checksums.rb14
1 files changed, 13 insertions, 1 deletions
diff --git a/lib/puppet/util/checksums.rb b/lib/puppet/util/checksums.rb
index 6fdf14ecf..e129301e6 100644
--- a/lib/puppet/util/checksums.rb
+++ b/lib/puppet/util/checksums.rb
@@ -68,7 +68,9 @@ module Puppet::Util::Checksums
nil
end
- alias :ctime_stream :mtime_stream
+ def mtime(content)
+ ""
+ end
# Calculate a checksum using Digest::SHA1.
def sha1(content)
@@ -108,6 +110,12 @@ module Puppet::Util::Checksums
File.stat(filename).send(:ctime)
end
+ alias :ctime_stream :mtime_stream
+
+ def ctime(content)
+ ""
+ end
+
# Return a "no checksum"
def none_file(filename)
""
@@ -119,6 +127,10 @@ module Puppet::Util::Checksums
""
end
+ def none(content)
+ ""
+ end
+
private
# Perform an incremental checksum on a file.