[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:20 UTC 2009


The following commit has been merged in the master branch:
commit 9577d3af929727ac1e7b5e7e54e4491990d55995
Author: Luke Kanies <luke at madstop.com>
Date:   Tue Mar 3 23:20:29 2009 -0600

    Fixing #2013 - prefetching had a mismatch between type and title
    
    The ParsedFile types seem to be the main one that suffers from
    this, but the transactions were using the resource titles,
    not names, so resources were often not getting prefetched
    correctly.
    
    Signed-off-by: Luke Kanies <luke at madstop.com>

diff --git a/lib/puppet/transaction.rb b/lib/puppet/transaction.rb
index f3defb7..43ba858 100644
--- a/lib/puppet/transaction.rb
+++ b/lib/puppet/transaction.rb
@@ -480,7 +480,7 @@ class Transaction
         @catalog.vertices.each do |resource|
             if provider = resource.provider and provider.class.respond_to?(:prefetch)
                 prefetchers[provider.class] ||= {}
-                prefetchers[provider.class][resource.title] = resource
+                prefetchers[provider.class][resource.name] = resource
             end
         end
 
diff --git a/spec/unit/transaction.rb b/spec/unit/transaction.rb
index e5ec640..9122e0e 100755
--- a/spec/unit/transaction.rb
+++ b/spec/unit/transaction.rb
@@ -4,6 +4,21 @@ require File.dirname(__FILE__) + '/../spec_helper'
 
 require 'puppet/transaction'
 
+describe Puppet::Transaction do
+    it "should match resources by name, not title, when prefetching" do
+        @catalog = Puppet::Node::Catalog.new
+        @transaction = Puppet::Transaction.new(@catalog)
+
+        # Have both a title and name
+        resource = Puppet::Type.type(:sshkey).create :title => "foo", :name => "bar", :type => :dsa, :key => "eh"
+        @catalog.add_resource resource
+
+        resource.provider.class.expects(:prefetch).with("bar" => resource)
+
+        @transaction.prefetch
+    end
+end
+
 describe Puppet::Transaction, " when determining tags" do
     before do
         @config = Puppet::Node::Catalog.new

-- 
Puppet packaging for Debian



More information about the Pkg-puppet-devel mailing list