summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--lib/puppet/parser/templatewrapper.rb7
-rwxr-xr-xspec/unit/parser/templatewrapper.rb8
2 files changed, 13 insertions, 2 deletions
diff --git a/lib/puppet/parser/templatewrapper.rb b/lib/puppet/parser/templatewrapper.rb
index 824fc48ef..00f364088 100644
--- a/lib/puppet/parser/templatewrapper.rb
+++ b/lib/puppet/parser/templatewrapper.rb
@@ -42,8 +42,13 @@ class Puppet::Parser::TemplateWrapper
return scope.catalog.classes
end
- # Allow templates to access the defined tags
+ # Allow templates to access the tags defined in the current scope
def tags
+ return scope.tags
+ end
+
+ # Allow templates to access the all the defined tags
+ def all_tags
return scope.catalog.tags
end
diff --git a/spec/unit/parser/templatewrapper.rb b/spec/unit/parser/templatewrapper.rb
index a8c464771..6dbfbe266 100755
--- a/spec/unit/parser/templatewrapper.rb
+++ b/spec/unit/parser/templatewrapper.rb
@@ -62,10 +62,16 @@ describe Puppet::Parser::TemplateWrapper do
tw.classes().should == ["class1", "class2"]
end
- it "should allow you to retrieve the defined tags with tags" do
+ it "should allow you to retrieve all the tags with all_tags" do
catalog = mock 'catalog', :tags => ["tag1", "tag2"]
@scope.expects(:catalog).returns( catalog )
tw = Puppet::Parser::TemplateWrapper.new(@scope, @file)
+ tw.all_tags().should == ["tag1","tag2"]
+ end
+
+ it "should allow you to retrieve the tags defined in the current scope" do
+ @scope.expects(:tags).returns( ["tag1", "tag2"] )
+ tw = Puppet::Parser::TemplateWrapper.new(@scope, @file)
tw.tags().should == ["tag1","tag2"]
end