[Pkg-puppet-devel] [SCM] Puppet packaging for Debian branch, master, updated. debian/0.24.7-1-98-gf19c0e5

James Turnbull james at lovedthanlost.net
Wed Apr 8 21:48:06 UTC 2009


The following commit has been merged in the master branch:
commit 32c2be926795ce3ce68f573367f7700e87ac8416
Author: Luke Kanies <luke at madstop.com>
Date:   Tue Feb 10 15:18:30 2009 -0600

    Fixed #1884 - exported defines are collected by the exporting host
    
    This was caused by the fix to #1472.  That fix unexported
    any resources collected from the local catalog.
    
    The crux of this fix is that it separates 'exported'
    and 'virtual' a bit more.  It also removes no-longer-needed
    functionality where resources copied their virtual or
    exported bits from the enclosing define or class.  This is
    now obsolete because we don't evaluate virtual defined resources.
    
    The crux of this commit is that defined resources can stay
    exported even though they're evaluated, and that exported state
    won't inherit to contained resources such that those then don't
    get evaluated.
    
    Signed-off-by: Luke Kanies <luke at madstop.com>

diff --git a/CHANGELOG b/CHANGELOG
index 99aafa1..ad5bfc9 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -1,5 +1,8 @@
 0.24.8
+    Fixed #1884 - Exported resources are marked as unexported when collected on the exporting host
+
     Fixed #1922 - Functions squash all arguments into a single hash
+    
     Fixed #1538 - Yumrepo sets permissions wrongly on files in /etc/yum.repos.d
 
     Fixed #1936 - Added /* */ support to the vim file
diff --git a/lib/puppet/parser/ast/resource.rb b/lib/puppet/parser/ast/resource.rb
index eb0bdea..d222893 100644
--- a/lib/puppet/parser/ast/resource.rb
+++ b/lib/puppet/parser/ast/resource.rb
@@ -32,8 +32,7 @@ class Resource < AST::ResourceReference
         # because sometimes the :virtual attribute is set *after*
         # :exported, in which case it clobbers :exported if :exported
         # is true.  Argh, this was a very tough one to track down.
-        exp = self.exported || scope.resource.exported?
-        virt = self.virtual || scope.resource.virtual? || exp
+        virt = self.virtual || self.exported
 
         # This is where our implicit iteration takes place; if someone
         # passed an array as the name, then we act just like the called us
diff --git a/lib/puppet/parser/collector.rb b/lib/puppet/parser/collector.rb
index 0f90725..bcba952 100644
--- a/lib/puppet/parser/collector.rb
+++ b/lib/puppet/parser/collector.rb
@@ -72,8 +72,7 @@ class Puppet::Parser::Collector
     def collect_exported
         # First get everything from the export table.  Just reuse our
         # collect_virtual method but tell it to use 'exported? for the test.
-        resources = collect_virtual(true).reject { |r| ! r.virtual? }.each { |r| r.exported = false }
-        #resources = collect_virtual(true).reject { |r| ! r.virtual? }
+        resources = collect_virtual(true).reject { |r| ! r.virtual? }
 
         count = resources.length
 
diff --git a/spec/unit/parser/ast/resource.rb b/spec/unit/parser/ast/resource.rb
index 1546d65..b257cb1 100755
--- a/spec/unit/parser/ast/resource.rb
+++ b/spec/unit/parser/ast/resource.rb
@@ -3,7 +3,6 @@
 require File.dirname(__FILE__) + '/../../../spec_helper'
 
 describe Puppet::Parser::AST::Resource do
-
     ast = Puppet::Parser::AST
 
     before :each do
@@ -19,7 +18,6 @@ describe Puppet::Parser::AST::Resource do
     end
 
     it "should evaluate all its parameters" do
-
         @param1.expects(:safeevaluate).with(@scope)
 
         @resource.evaluate(@scope)
@@ -86,5 +84,20 @@ describe Puppet::Parser::AST::Resource do
         @resource.title = titles
         @resource.evaluate(@scope).should == [resource]
     end
-end
 
+    it "should generate virtual resources if it is virtual" do
+        @resource.virtual = true
+
+        Puppet::Parser::Resource.expects(:new).with { |hash| hash[:virtual] == true }
+
+        @resource.evaluate(@scope)
+    end
+
+    it "should generate virtual and exported resources if it is exported" do
+        @resource.exported = true
+
+        Puppet::Parser::Resource.expects(:new).with { |hash| hash[:virtual] == true and hash[:exported] == true }
+
+        @resource.evaluate(@scope)
+    end
+end
diff --git a/spec/unit/parser/collector.rb b/spec/unit/parser/collector.rb
index ede583b..59d62d6 100755
--- a/spec/unit/parser/collector.rb
+++ b/spec/unit/parser/collector.rb
@@ -240,10 +240,10 @@ describe Puppet::Parser::Collector, "when collecting exported resources" do
         one = stub 'one', :type => "Mytype", :virtual? => true, :exported? => true
         two = stub 'two', :type => "Mytype", :virtual? => true, :exported? => true
 
-        one.expects(:exported=).with(false)
-        one.expects(:virtual=).with(false)
-        two.expects(:exported=).with(false)
-        two.expects(:virtual=).with(false)
+        one.stubs(:exported=)
+        one.stubs(:virtual=)
+        two.stubs(:exported=)
+        two.stubs(:virtual=)
 
         @compiler.expects(:resources).returns([one, two])
 

-- 
Puppet packaging for Debian



More information about the Pkg-puppet-devel mailing list