summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorluke <luke@980ebf18-57e1-0310-9a29-db15c13687c0>2007-01-04 19:47:05 +0000
committerluke <luke@980ebf18-57e1-0310-9a29-db15c13687c0>2007-01-04 19:47:05 +0000
commit9c1a4464a95220c07c0dbc4b761bc70d4177183f (patch)
treef87f827d3bfa6cddd4f0d397e29ac8e26b5b4b57
parent2b271f8ab5853a6b48de14ca52a20979c96d42a4 (diff)
downloadpuppet-9c1a4464a95220c07c0dbc4b761bc70d4177183f.tar.gz
puppet-9c1a4464a95220c07c0dbc4b761bc70d4177183f.tar.xz
puppet-9c1a4464a95220c07c0dbc4b761bc70d4177183f.zip
Fixing #403.
git-svn-id: https://reductivelabs.com/svn/puppet/trunk@2036 980ebf18-57e1-0310-9a29-db15c13687c0
-rwxr-xr-xlib/puppet/type/pfile/ensure.rb5
-rwxr-xr-xtest/types/file.rb10
2 files changed, 13 insertions, 2 deletions
diff --git a/lib/puppet/type/pfile/ensure.rb b/lib/puppet/type/pfile/ensure.rb
index 6f7b15d49..9e1eec86d 100755
--- a/lib/puppet/type/pfile/ensure.rb
+++ b/lib/puppet/type/pfile/ensure.rb
@@ -154,8 +154,9 @@ module Puppet
end
def sync
- unless self.should == :absent
- @parent.remove_existing(self.should)
+ @parent.remove_existing(self.should)
+ if self.should == :absent
+ return :file_removed
end
event = super
diff --git a/test/types/file.rb b/test/types/file.rb
index 80e2563d8..61ee14694 100755
--- a/test/types/file.rb
+++ b/test/types/file.rb
@@ -1913,6 +1913,16 @@ class TestFile < Test::Unit::TestCase
assert(fileobj, "did not generate file object")
assert_equal("/%s" % fileobj.ref, fileobj.path, "did not generate correct subfile path")
end
+
+ # Testing #403
+ def test_removal_with_content_set
+ path = tempfile()
+ File.open(path, "w") { |f| f.puts "yay" }
+ file = Puppet::Type.newfile(:name => path, :ensure => :absent, :content => "foo")
+
+ assert_apply(file)
+ assert(! FileTest.exists?(path), "File was not removed")
+ end
end
# $Id$