Signed-off-by: Brice Figureau <[EMAIL PROTECTED]>
---
 lib/puppet/parser/ast/hostclass.rb |    7 ++++++-
 spec/unit/parser/ast/hostclass.rb  |   13 +++++++++++++
 2 files changed, 19 insertions(+), 1 deletions(-)

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)
-- 
1.6.0.2


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Puppet Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/puppet-dev?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to