[Pkg-puppet-devel] [SCM] Puppet packaging for Debian branch, upstream, updated. 2.6.1rc1-141-gcdb2b90
James Turnbull
james at lovedthanlost.net
Mon Aug 16 12:47:42 UTC 2010
The following commit has been merged in the upstream branch:
commit 34d189725c82e221793dc51c04ecb68e43ed3115
Author: Nick Lewis <nick at puppetlabs.com>
Date: Thu Jun 17 17:49:29 2010 -0700
[#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.
diff --git a/lib/puppet/type/file.rb b/lib/puppet/type/file.rb
index 0aaad3e..5bb4be1 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
diff --git a/spec/unit/type/file.rb b/spec/unit/type/file.rb
index 206a50e..b2f1292 100755
--- a/spec/unit/type/file.rb
+++ b/spec/unit/type/file.rb
@@ -694,6 +694,14 @@ describe Puppet::Type.type(:file) do
end
end
+ it "should pass on ensure and recurse to the sub resource if ensure is absent and recurse is true" do
+ @file = Puppet::Type::File.new(:name => "/foo/bar", :ensure => :absent, :recurse => true, :catalog => @catalog)
+
+ @file.class.expects(:new).with { |params| params[:ensure] == :absent and params[:recurse] == true }
+
+ @file.newchild("my/path")
+ end
+
it "should copy all of the parent resource's 'should' values that were set at initialization" do
file = @file.class.new(:path => "/foo/bar", :owner => "root", :group => "wheel")
@catalog.add_resource(file)
--
Puppet packaging for Debian
More information about the Pkg-puppet-devel
mailing list