summaryrefslogtreecommitdiffstats
path: root/lib/puppet
diff options
context:
space:
mode:
Diffstat (limited to 'lib/puppet')
-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