[Pkg-puppet-devel] [SCM] Puppet packaging for Debian branch, master, updated. 2.6.3-345-g919f443

Markus Roberts Markus at reality.com
Wed Nov 17 18:21:04 UTC 2010


The following commit has been merged in the master branch:
commit b2ff6a50202a05f2925fa5046a39ef7f163983f1
Author: Markus Roberts <Markus at reality.com>
Date:   Mon Nov 15 19:19:02 2010 -0800

    Fix for #5298 -- Collections need to do type lookup
    
    When the responsibility for type-name resolution was moved to the AST nodes in
    commit 449315a2c705df2396852462a1d1e14774b9f117, at least one instance was
    missed: the space ship operator
    
        Myclass <<| tag == foo |>>
    
    fails unless Myclass has been previously loaded.  This commit adds the lookup
    to AST::Collection nodes in the same way it was added to the other node types.
    
    Note that I haven't audited the other note types for similar cases.

diff --git a/lib/puppet/parser/ast/collection.rb b/lib/puppet/parser/ast/collection.rb
index 90a9143..ef36b71 100644
--- a/lib/puppet/parser/ast/collection.rb
+++ b/lib/puppet/parser/ast/collection.rb
@@ -15,7 +15,8 @@ class Puppet::Parser::AST
     def evaluate(scope)
       str, code = query && query.safeevaluate(scope)
 
-      newcoll = Puppet::Parser::Collector.new(scope, @type, str, code, self.form)
+      resource_type = scope.find_resource_type(@type)
+      newcoll = Puppet::Parser::Collector.new(scope, resource_type.name, str, code, self.form)
 
       scope.compiler.add_collection(newcoll)
 
diff --git a/spec/unit/parser/ast/collection_spec.rb b/spec/unit/parser/ast/collection_spec.rb
index 3f7878a..392a2c0 100755
--- a/spec/unit/parser/ast/collection_spec.rb
+++ b/spec/unit/parser/ast/collection_spec.rb
@@ -5,6 +5,8 @@ require File.dirname(__FILE__) + '/../../../spec_helper'
 describe Puppet::Parser::AST::Collection do
   before :each do
     @scope = stub_everything 'scope'
+    @mytype = stub_everything('mytype')
+    @scope.stubs(:find_resource_type).returns @mytype
     @compiler = stub_everything 'compile'
     @scope.stubs(:compiler).returns(@compiler)
 
@@ -24,6 +26,8 @@ describe Puppet::Parser::AST::Collection do
 
   it "should instantiate a Collector for this type" do
     collection = Puppet::Parser::AST::Collection.new :form => :virtual, :type => "test"
+    @test_type = stub 'type', :name => 'test'
+    @scope.expects(:find_resource_type).with('test').returns @test_type
 
     Puppet::Parser::Collector.expects(:new).with(@scope, "test", nil, nil, :virtual)
 

-- 
Puppet packaging for Debian



More information about the Pkg-puppet-devel mailing list