diff options
author | luke <luke@980ebf18-57e1-0310-9a29-db15c13687c0> | 2006-09-03 02:37:56 +0000 |
---|---|---|
committer | luke <luke@980ebf18-57e1-0310-9a29-db15c13687c0> | 2006-09-03 02:37:56 +0000 |
commit | ff18e5592467c4b8fe2cedf48cd8f9332e0eff32 (patch) | |
tree | e82086f972e4e432a9b70cda723d85997e7ffc82 /lib | |
parent | 18320ee5144c76de4d1d2c5c0fa27fd719882991 (diff) | |
download | puppet-ff18e5592467c4b8fe2cedf48cd8f9332e0eff32.tar.gz puppet-ff18e5592467c4b8fe2cedf48cd8f9332e0eff32.tar.xz puppet-ff18e5592467c4b8fe2cedf48cd8f9332e0eff32.zip |
Adding support for file purging, as requested in #250. Any unmanaged files in a purge-enabled directory will be removed.
git-svn-id: https://reductivelabs.com/svn/puppet/trunk@1539 980ebf18-57e1-0310-9a29-db15c13687c0
Diffstat (limited to 'lib')
-rw-r--r-- | lib/puppet/type/pfile.rb | 21 |
1 files changed, 20 insertions, 1 deletions
diff --git a/lib/puppet/type/pfile.rb b/lib/puppet/type/pfile.rb index 8a12ee32a..ec666497d 100644 --- a/lib/puppet/type/pfile.rb +++ b/lib/puppet/type/pfile.rb @@ -160,6 +160,18 @@ module Puppet defaultto :ignore end + newparam(:purge) do + desc "Whether unmanaged files should be purged. If you have a filebucket + configured the purged files will be uploaded, but if you do not, + this will destroy data. Only use this option for generated + files unless you really know what you are doing. This option only + makes sense when recursively managing directories." + + defaultto :false + + newvalues(:true, :false) + end + autorequire(:file) do cur = [] pary = self[:path].split(File::SEPARATOR) @@ -675,7 +687,14 @@ module Puppet children.each { |file| file = File.basename(file) next if file =~ /^\.\.?$/ # skip . and .. - if child = self.newchild(file, true, :recurse => recurse) + options = {:recurse => recurse} + + if child = self.newchild(file, true, options) + # Mark any unmanaged files for removal if purge is set. + if self[:purge] == :true and child.implicit? + child[:ensure] = :absent + end + unless @children.include?(child) self.push child added.push file |