summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorLuke Kanies <luke@reductivelabs.com>2010-03-19 22:13:38 -0700
committertest branch <puppet-dev@googlegroups.com>2010-02-17 06:50:53 -0800
commit3eeebf51f8b444193227c36162d4e74a95e96b79 (patch)
treee4ea9c0ae5db17b8fa312aab27c0d2c124bb590e /lib
parent47c3ca18272e38f16d0e5690c2c9a0e0dbac3285 (diff)
downloadpuppet-3eeebf51f8b444193227c36162d4e74a95e96b79.tar.gz
puppet-3eeebf51f8b444193227c36162d4e74a95e96b79.tar.xz
puppet-3eeebf51f8b444193227c36162d4e74a95e96b79.zip
Fixing change printing for content/ensure
Signed-off-by: Luke Kanies <luke@reductivelabs.com>
Diffstat (limited to 'lib')
-rwxr-xr-xlib/puppet/type/file/content.rb4
-rwxr-xr-xlib/puppet/type/file/ensure.rb9
2 files changed, 9 insertions, 4 deletions
diff --git a/lib/puppet/type/file/content.rb b/lib/puppet/type/file/content.rb
index a8a5e7c73..b6c671b98 100755
--- a/lib/puppet/type/file/content.rb
+++ b/lib/puppet/type/file/content.rb
@@ -43,8 +43,8 @@ module Puppet
# Checksums need to invert how changes are printed.
def change_to_s(currentvalue, newvalue)
# Our "new" checksum value is provided by the source.
- if source = resource.parameter(:source)
- newvalue = source.checksum || "unknown checksum"
+ if source = resource.parameter(:source) and tmp = source.checksum
+ newvalue = tmp
end
if currentvalue == :absent
return "defined content as '%s'" % [newvalue]
diff --git a/lib/puppet/type/file/ensure.rb b/lib/puppet/type/file/ensure.rb
index fc4bbea3c..b2dd39459 100755
--- a/lib/puppet/type/file/ensure.rb
+++ b/lib/puppet/type/file/ensure.rb
@@ -42,7 +42,7 @@ module Puppet
newvalue(:file, :event => :file_created) do
# Make sure we're not managing the content some other way
- if property = (@resource.property(:content) || @resource.property(:source))
+ if property = @resource.property(:content)
property.sync
else
@resource.write("", :ensure)
@@ -108,8 +108,13 @@ module Puppet
else
should = property.should
end
+ if should == :absent
+ is = property.retrieve
+ else
+ is = :absent
+ end
- return property.change_to_s(property.retrieve, should)
+ return property.change_to_s(is, should)
end
# Check that we can actually create anything