summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorNick Lewis <nick@puppetlabs.com>2010-06-17 17:49:29 -0700
committerJames Turnbull <james@lovedthanlost.net>2010-06-27 03:48:07 +1000
commit34d189725c82e221793dc51c04ecb68e43ed3115 (patch)
treef7940110616690ee8b05527c3988c4e2e96263aa /lib
parent9d0d94c27174bc25ba823028a612f8fa04dd847b (diff)
[#3835] Fixed recursively absent directories improperly managing their files
Children of recursively absent (and only recursively absent) directories now inherit the recursively absent behavior when they are created. This stops the files from trying to be created, generating lots of failure messages. This doesn't affect directories which are absent and not recursive (whose children aren't even attempted to be created, or directories which aren't absent.
Diffstat (limited to 'lib')
-rw-r--r--lib/puppet/type/file.rb10
1 files changed, 9 insertions, 1 deletions
diff --git a/lib/puppet/type/file.rb b/lib/puppet/type/file.rb
index 0aaad3e97..5bb4be1e4 100644
--- a/lib/puppet/type/file.rb
+++ b/lib/puppet/type/file.rb
@@ -433,8 +433,16 @@ module Puppet
# The right-side hash wins in the merge.
options = @original_parameters.merge(:path => full_path).reject { |param, value| value.nil? }
+ # If we are recursive and ensure => absent, then our children should be too,
+ # so that they will go away like they should.
+ # Otherwise they shouldn't get those options
+ unless options[:ensure].to_s == "absent" and options[:recurse] == true
+ options.delete(:ensure)
+ options.delete(:recurse)
+ end
+
# These should never be passed to our children.
- [:parent, :ensure, :recurse, :recurselimit, :target, :alias, :source].each do |param|
+ [:parent, :recurselimit, :target, :alias, :source].each do |param|
options.delete(param) if options.include?(param)
end