diff options
author | Luke Kanies <luke@madstop.com> | 2008-10-28 17:50:20 -0500 |
---|---|---|
committer | Luke Kanies <luke@madstop.com> | 2008-11-04 16:20:45 -0600 |
commit | 6f7ccff8bb764dffd1d41d5391dd79f7bd4a387c (patch) | |
tree | 4ed9cf36fcf35b4edeaef5644257148139e4dafd /lib | |
parent | a4d4444ba216cb3627e03bb45e2eb92424740a44 (diff) | |
download | puppet-6f7ccff8bb764dffd1d41d5391dd79f7bd4a387c.tar.gz puppet-6f7ccff8bb764dffd1d41d5391dd79f7bd4a387c.tar.xz puppet-6f7ccff8bb764dffd1d41d5391dd79f7bd4a387c.zip |
Fixing #1641 - file recursion now only passes original parameters to child resources.
Previously, parameter values provided by remote sources or default values
were all passed to children, which provided strange state maintenance.
Signed-off-by: Luke Kanies <luke@madstop.com>
Diffstat (limited to 'lib')
-rw-r--r-- | lib/puppet/type/file.rb | 18 |
1 files changed, 14 insertions, 4 deletions
diff --git a/lib/puppet/type/file.rb b/lib/puppet/type/file.rb index 922550bd8..6038aa50b 100644 --- a/lib/puppet/type/file.rb +++ b/lib/puppet/type/file.rb @@ -441,7 +441,7 @@ module Puppet def initialize(hash) # Store a copy of the arguments for later. - tmphash = hash.to_hash + @original_arguments = hash.to_hash # Used for caching clients @clients = {} @@ -461,9 +461,19 @@ module Puppet def newchild(path) full_path = File.join(self[:path], path) - # the right-side hash wins in the merge. - options = to_hash.merge(:path => full_path, :implicit => true).reject { |param, value| value.nil? } - [:parent, :recurse, :target].each do |param| + # Add some new values to our original arguments -- these are the ones + # set at initialization. We specifically want to exclude any param + # values set by the :source property or any default values. + # LAK:NOTE This is kind of silly, because the whole point here is that + # the values set at initialization should live as long as the resource + # but values set by default or by :source should only live for the transaction + # or so. Unfortunately, we don't have a straightforward way to manage + # the different lifetimes of this data, so we kludge it like this. + # The right-side hash wins in the merge. + options = @original_arguments.merge(:path => full_path, :implicit => true).reject { |param, value| value.nil? } + + # These should never be passed to our children. + [:parent, :ensure, :recurse, :target].each do |param| options.delete(param) if options.include?(param) end |