From 3eeebf51f8b444193227c36162d4e74a95e96b79 Mon Sep 17 00:00:00 2001 From: Luke Kanies Date: Fri, 19 Mar 2010 22:13:38 -0700 Subject: Fixing change printing for content/ensure Signed-off-by: Luke Kanies --- lib/puppet/type/file/content.rb | 4 ++-- lib/puppet/type/file/ensure.rb | 9 +++++++-- 2 files changed, 9 insertions(+), 4 deletions(-) (limited to 'lib/puppet') 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 -- cgit