[Pkg-puppet-devel] [SCM] Puppet packaging for Debian branch, upstream, updated. puppet-0.24.5-rc3-1601-gf8c1b08

James Turnbull james at lovedthanlost.net
Fri Jan 15 09:08:36 UTC 2010


The following commit has been merged in the upstream branch:
commit 13cbf043c6e16c14b0ab9fccd5738a8c9e5925b3
Author: Jesse Wolfe <jes5199 at gmail.com>
Date:   Wed Dec 30 21:20:45 2009 -0800

    ReFix 2675 ending slash in directory should get stripped off
    
    There was an intermittent bug in Puppet::Parser::Resource::Reference,
    during initialization, and object could sometimes have its title set
    before its type is set. This prevented the title from going through
    type-specific canonicalization.
    
    Signed-off-by: Jesse Wolfe <jes5199 at gmail.com>

diff --git a/lib/puppet/resource/reference.rb b/lib/puppet/resource/reference.rb
index dce4449..eddb2d9 100644
--- a/lib/puppet/resource/reference.rb
+++ b/lib/puppet/resource/reference.rb
@@ -50,6 +50,10 @@ class Puppet::Resource::Reference
             # LAK:NOTE See http://snurl.com/21zf8  [groups_google_com]
             x = @type = value.to_s.split("::").collect { |s| s.capitalize }.join("::")
         end
+
+        if @title
+            self.title = @title
+        end
     end
 
     # Convert to the reference format that TransObject uses.  Yay backward
diff --git a/spec/unit/parser/resource.rb b/spec/unit/parser/resource.rb
index 3f08de9..d41d4f4 100755
--- a/spec/unit/parser/resource.rb
+++ b/spec/unit/parser/resource.rb
@@ -101,6 +101,17 @@ describe Puppet::Parser::Resource do
         end
     end
 
+    describe "when refering to a resource with name canonicalization" do
+        before do
+            @arguments = {:type => "file", :title => "/path/", :scope => stub('scope', :source => mock('source'))}
+        end
+
+        it "should canonicalize its own name" do
+            res = Puppet::Parser::Resource.new(@arguments)
+            res.ref.should == "File[/path]"
+        end
+    end
+
     describe "when evaluating" do
         before do
             @type = Puppet::Parser::Resource
diff --git a/spec/unit/parser/resource/reference.rb b/spec/unit/parser/resource/reference.rb
index a703f92..19fe076 100755
--- a/spec/unit/parser/resource/reference.rb
+++ b/spec/unit/parser/resource/reference.rb
@@ -49,6 +49,13 @@ describe Puppet::Parser::Resource::Reference do
         ref = @type.new(:type => "file", :title => "/tmp/yay/")
         ref.to_s.should == "File[/tmp/yay]"
     end
+
+    it "should canonize resource reference values without order dependencies" do
+        args = [[:title, "/tmp/yay/"], [:type, "file"]]
+        ref = @type.new(args)
+        ref.to_s.should == "File[/tmp/yay]"
+    end
+
 end
 
 describe Puppet::Parser::Resource::Reference, " when modeling defined types" do

-- 
Puppet packaging for Debian



More information about the Pkg-puppet-devel mailing list