[Pkg-puppet-devel] [SCM] Puppet packaging for Debian branch, master, updated. debian/0.24.6-1-356-g5718585

James Turnbull james at lovedthanlost.net
Fri Jan 23 14:21:31 UTC 2009


The following commit has been merged in the master branch:
commit 9ecbd6306d227189ba161954aafc3e7f782a87b9
Author: Brice Figureau <brice-puppet at daysofwonder.com>
Date:   Sat Oct 11 18:45:16 2008 +0200

    Fixed #1104 - Classes and nodes should set $name variables
    
    Signed-off-by: Brice Figureau <brice-puppet at daysofwonder.com>

diff --git a/CHANGELOG b/CHANGELOG
index 00f4b5a..3b496c5 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -1,4 +1,6 @@
 0.24.x
+    Fixed #1104 - Classes and nodes should set $name variables
+
     Updated Red Hat spec file for 0.24.6
 
     Removed conf/debian directory - Debian packaging information 
diff --git a/lib/puppet/parser/ast/hostclass.rb b/lib/puppet/parser/ast/hostclass.rb
index 7f89f81..4f5c479 100644
--- a/lib/puppet/parser/ast/hostclass.rb
+++ b/lib/puppet/parser/ast/hostclass.rb
@@ -56,7 +56,12 @@ class Puppet::Parser::AST::HostClass < Puppet::Parser::AST::Definition
 
         # Don't create a subscope for the top-level class, since it already
         # has its own scope.
-        scope = subscope(scope, resource) unless resource.title == :main
+        unless resource.title == :main
+            scope = subscope(scope, resource)
+
+            scope.setvar("title", resource.title)
+            scope.setvar("name", resource.name)
+        end
 
         # Add the parent scope namespaces to our own.
         if pnames
diff --git a/spec/unit/parser/ast/hostclass.rb b/spec/unit/parser/ast/hostclass.rb
index 0abc174..10aa621 100755
--- a/spec/unit/parser/ast/hostclass.rb
+++ b/spec/unit/parser/ast/hostclass.rb
@@ -123,6 +123,19 @@ describe Puppet::Parser::AST::HostClass do
             @compiler.class_scope(@middle).parent.should equal(@compiler.class_scope(@top))
         end
 
+        it "should add the class's name and title to its own scope" do
+            @top_resource.stubs(:safeevaluate)
+            @middle_resource.stubs(:safeevaluate)
+            resource = @middle.evaluate(@scope)
+            scope = stub_everything 'scope', :compiler => @compiler
+            @middle.stubs(:subscope).returns(scope)
+
+            scope.expects(:setvar).with("title","top::middle")
+            scope.expects(:setvar).with("name","top::middle")
+
+            @middle.evaluate_code(resource)
+        end
+
         it "should add the parent class's namespace to its namespace search path" do
             @top_resource.stubs(:safeevaluate)
             @middle_resource.stubs(:safeevaluate)

-- 
Puppet packaging for Debian



More information about the Pkg-puppet-devel mailing list