[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:27 UTC 2009
The following commit has been merged in the master branch:
commit ec2b4619d3c90b09e1b9fda0020552d5a2d6061f
Author: Brice Figureau <brice-puppet at daysofwonder.com>
Date: Sat Oct 18 12:53:27 2008 +0200
Fix #1115 - part2 - fix tests and add all_tags
Up until this patch, TemplateWrapper.tags was returning all the tags
defined in the catalog. I think this is wrong and tags shoul only
return the defined tags in the current scope.
Hence, I defined a all_tags method that returns the list of tags defined
in the whole catalog.
diff --git a/lib/puppet/parser/templatewrapper.rb b/lib/puppet/parser/templatewrapper.rb
index 824fc48..00f3640 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 a8c4647..6dbfbe2 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
--
Puppet packaging for Debian
More information about the Pkg-puppet-devel
mailing list