summaryrefslogtreecommitdiffstats
path: root/lib/puppet
diff options
context:
space:
mode:
authorLuke Kanies <luke@madstop.com>2009-02-17 12:26:58 -0600
committerJames Turnbull <james@lovedthanlost.net>2009-02-18 08:18:57 +1100
commitd758f45a14057f0b9517a1905d575d6b28b90bc2 (patch)
treefb92dddbd77f81d612f88ab9eb4afc1d47c6c846 /lib/puppet
parentc0f494334b374d6f0b0eb3d5741aaff70052d564 (diff)
downloadpuppet-d758f45a14057f0b9517a1905d575d6b28b90bc2.tar.gz
puppet-d758f45a14057f0b9517a1905d575d6b28b90bc2.tar.xz
puppet-d758f45a14057f0b9517a1905d575d6b28b90bc2.zip
Fixing #1871 once and for all - contents are never printed
They were still being printed in noop mode. The fix was to use is_to_s and should_to_s methods, rather than 'change_to_s'. Signed-off-by: Luke Kanies <luke@madstop.com>
Diffstat (limited to 'lib/puppet')
-rwxr-xr-xlib/puppet/type/file/content.rb19
1 files changed, 11 insertions, 8 deletions
diff --git a/lib/puppet/type/file/content.rb b/lib/puppet/type/file/content.rb
index 1eb1423aa..00a598443 100755
--- a/lib/puppet/type/file/content.rb
+++ b/lib/puppet/type/file/content.rb
@@ -22,14 +22,17 @@ module Puppet
This attribute is especially useful when used with
`PuppetTemplating templating`:trac:."
- def change_to_s(currentvalue, newvalue)
- newvalue = "{md5}" + Digest::MD5.hexdigest(newvalue)
- 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
# Override this method to provide diffs if asked for.