From b3b76dffdd9cd8ed5c3d0230624bf05015bec5b8 Mon Sep 17 00:00:00 2001 From: Luke Kanies Date: Thu, 23 Jul 2009 16:51:22 -0700 Subject: Fixing #2296 - overlapping recursions work again This fixes the behaviour when you have file recursions that overlap - we again correctly use the most specific information. It's still a bit expensive when you do this, but at least it behaves correctly, and it should be a rare circumstance. Signed-off-by: Luke Kanies --- spec/integration/type/file.rb | 21 +++++++++++++++++++++ spec/unit/type/file.rb | 7 +------ 2 files changed, 22 insertions(+), 6 deletions(-) (limited to 'spec') diff --git a/spec/integration/type/file.rb b/spec/integration/type/file.rb index cced1ed1c..3b03d53e3 100755 --- a/spec/integration/type/file.rb +++ b/spec/integration/type/file.rb @@ -115,6 +115,27 @@ describe Puppet::Type.type(:file) do File.lstat(newpath).ftype.should == "file" end end + + it "should not recursively manage files managed by a more specific explicit file" do + dir = tmpfile("file_source_integration_source") + + subdir = File.join(dir, "subdir") + file = File.join(subdir, "file") + + FileUtils.mkdir_p(subdir) + File.open(file, "w") { |f| f.puts "" } + + base = Puppet::Type::File.new(:name => dir, :recurse => true, :backup => false, :mode => "755") + sub = Puppet::Type::File.new(:name => subdir, :recurse => true, :backup => false, :mode => "644") + + @catalog = Puppet::Resource::Catalog.new + @catalog.add_resource base + @catalog.add_resource sub + + @catalog.apply + + (File.stat(file).mode & 007777).should == 0644 + end end describe "when generating resources" do diff --git a/spec/unit/type/file.rb b/spec/unit/type/file.rb index 627cac41a..6ec86e7a1 100755 --- a/spec/unit/type/file.rb +++ b/spec/unit/type/file.rb @@ -12,8 +12,7 @@ describe Puppet::Type.type(:file) do @path = pathname @file = Puppet::Type::File.new(:name => @path) - @catalog = mock 'catalog' - @catalog.stub_everything + @catalog = Puppet::Resource::Catalog.new @file.catalog = @catalog end @@ -108,7 +107,6 @@ describe Puppet::Type.type(:file) do :path => @link, :mode => "755" ) - @catalog = Puppet::Resource::Catalog.new @catalog.add_resource @resource end @@ -513,9 +511,6 @@ describe Puppet::Type.type(:file) do describe "when returning resources with :eval_generate" do before do - @catalog = mock 'catalog' - @catalog.stub_everything - @graph = stub 'graph', :add_edge => nil @catalog.stubs(:relationship_graph).returns @graph -- cgit