[Pkg-puppet-devel] [SCM] Puppet packaging for Debian branch, upstream, updated. 0.25.5-639-g8f94f35

Markus Roberts Markus at reality.com
Wed Jul 14 10:35:37 UTC 2010


The following commit has been merged in the upstream branch:
commit 770a8ea2beb58cff52f5e532a777d7046aa2efb0
Author: Brice Figureau <brice-puppet at daysofwonder.com>
Date:   Sat Apr 24 13:47:00 2010 +0200

    Fix #3665 - main class shouldn't be a subscope of itself
    
    During the refactoring of AST hostclass/node to non AST objects, we lost
    the fact that the main class already comes with a scope (ie the top one),
    so when we evaluate its code we shouldn't create a subscope for it.
    
    Signed-off-by: Brice Figureau <brice-puppet at daysofwonder.com>

diff --git a/lib/puppet/resource/type.rb b/lib/puppet/resource/type.rb
index ab57f96..825cce3 100644
--- a/lib/puppet/resource/type.rb
+++ b/lib/puppet/resource/type.rb
@@ -69,7 +69,7 @@ class Puppet::Resource::Type
             scope = tmp
         end
 
-        scope = subscope(scope, resource)
+        scope = subscope(scope, resource) unless resource.title == :main
 
         set_resource_parameters(resource, scope)
 
diff --git a/spec/unit/resource/type_spec.rb b/spec/unit/resource/type_spec.rb
index fdb81f7..781721d 100755
--- a/spec/unit/resource/type_spec.rb
+++ b/spec/unit/resource/type_spec.rb
@@ -412,6 +412,14 @@ describe Puppet::Resource::Type do
             @type.evaluate_code(@resource)
         end
 
+        it "should not create a subscope for the :main class" do
+            @resource.stubs(:title).returns(:main)
+            @type.expects(:subscope).never
+            @type.expects(:set_resource_parameters).with(@resource, @scope)
+
+            @type.evaluate_code(@resource)
+        end
+
         it "should store the class scope" do
             @type.evaluate_code(@resource)
             @scope.class_scope(@type).should be_instance_of(@scope.class)

-- 
Puppet packaging for Debian



More information about the Pkg-puppet-devel mailing list