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

test branch puppet-dev at googlegroups.com
Wed Jul 14 10:34:54 UTC 2010


The following commit has been merged in the upstream branch:
commit f35c59f83b8df2e595ec44a6258dbae30c81237e
Author: Brice Figureau <brice-puppet at daysofwonder.com>
Date:   Sun Apr 25 17:52:37 2010 +0200

    Fix #3667 - Fix class namespace
    
    Class namespace is different than namespace of nodes and definition as
    it contains the whole qualified name.
    This bit was left out in the type are not AST anymore refactoring.
    
    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 e60f879..ab57f96 100644
--- a/lib/puppet/resource/type.rb
+++ b/lib/puppet/resource/type.rb
@@ -289,7 +289,11 @@ class Puppet::Resource::Type
             @namespace = ""
         else
             @name = name.to_s.downcase
-            @namespace, ignored_shortname = namesplit(@name)
+
+            # Note we're doing something somewhat weird here -- we're setting
+            # the class's namespace to its fully qualified name.  This means
+            # anything inside that class starts looking in that namespace first.
+            @namespace, ignored_shortname = @type == :hostclass ? [@name, ''] : namesplit(@name)
         end
     end
 
diff --git a/spec/unit/resource/type.rb b/spec/unit/resource/type.rb
index 514e694..fdb81f7 100755
--- a/spec/unit/resource/type.rb
+++ b/spec/unit/resource/type.rb
@@ -172,8 +172,14 @@ describe Puppet::Resource::Type do
             Puppet::Resource::Type.new(:hostclass, "Foo::Bar".intern).name.should == "foo::bar"
         end
 
-        it "should set its namespace to the downcased, stringified qualified portion of the name" do
-            Puppet::Resource::Type.new(:hostclass, "Foo::Bar::Baz".intern).namespace.should == "foo::bar"
+        it "should set its namespace to the downcased, stringified qualified name for classes" do
+            Puppet::Resource::Type.new(:hostclass, "Foo::Bar::Baz".intern).namespace.should == "foo::bar::baz"
+        end
+
+        [:definition, :node].each do |type|
+            it "should set its namespace to the downcased, stringified qualified portion of the name for #{type}s" do
+                Puppet::Resource::Type.new(type, "Foo::Bar::Baz".intern).namespace.should == "foo::bar"
+            end
         end
 
         %w{code line file doc}.each do |arg|

-- 
Puppet packaging for Debian



More information about the Pkg-puppet-devel mailing list