summaryrefslogtreecommitdiffstats
path: root/lib/puppet
diff options
context:
space:
mode:
authorLuke Kanies <luke@madstop.com>2009-02-20 09:51:12 -0600
committerLuke Kanies <luke@madstop.com>2009-02-20 09:51:12 -0600
commit602409e18c5b3229f6d239ac28472dd4709a117b (patch)
tree1a6ed7f73c65bf97f4e419e626dba4c8f29a7873 /lib/puppet
parentc0d5037d11643fd551fdc9f20a9e0ba196c5345a (diff)
parentd758f45a14057f0b9517a1905d575d6b28b90bc2 (diff)
downloadpuppet-602409e18c5b3229f6d239ac28472dd4709a117b.tar.gz
puppet-602409e18c5b3229f6d239ac28472dd4709a117b.tar.xz
puppet-602409e18c5b3229f6d239ac28472dd4709a117b.zip
Merge branch '0.24.x'
Conflicts: lib/puppet/type/file/content.rb spec/unit/type/file/content.rb
Diffstat (limited to 'lib/puppet')
-rwxr-xr-xlib/puppet/type/file/content.rb23
1 files changed, 11 insertions, 12 deletions
diff --git a/lib/puppet/type/file/content.rb b/lib/puppet/type/file/content.rb
index 6d6dad4f1..385a86357 100755
--- a/lib/puppet/type/file/content.rb
+++ b/lib/puppet/type/file/content.rb
@@ -25,18 +25,17 @@ module Puppet
This attribute is especially useful when used with
`PuppetTemplating templating`:trac:."
- def change_to_s(currentvalue, newvalue)
- if source = resource.parameter(:source)
- newvalue = source.metadata.checksum
- else
- newvalue = "{md5}" + Digest::MD5.hexdigest(newvalue)
- end
- if currentvalue == :absent
- return "created file with contents %s" % newvalue
- else
- currentvalue = "{md5}" + Digest::MD5.hexdigest(currentvalue)
- return "changed file contents from %s to %s" % [currentvalue, newvalue]
- end
+ def string_as_checksum(string)
+ return "absent" if string == :absent
+ "{md5}" + Digest::MD5.hexdigest(string)
+ end
+
+ def should_to_s(should)
+ string_as_checksum(should)
+ end
+
+ def is_to_s(is)
+ string_as_checksum(is)
end
def content