Fixed a problem with tag function. If you run the function tag(['a','b','c']), 
it ends up with a tag of 'abc' rather than three distinct tags.

Thanks,

Nan
---
 lib/puppet/util/tagging.rb     |    2 +-
 spec/unit/util/tagging_spec.rb |    6 ++++++
 2 files changed, 7 insertions(+), 1 deletions(-)

diff --git a/lib/puppet/util/tagging.rb b/lib/puppet/util/tagging.rb
index 6323ee0..284a2d4 100644
--- a/lib/puppet/util/tagging.rb
+++ b/lib/puppet/util/tagging.rb
@@ -10,7 +10,7 @@ module Puppet::Util::Tagging
 
     qualified = []
 
-    ary.collect { |tag| tag.to_s.downcase }.each do |tag|
+    ary.flatten.collect { |tag| tag.to_s.downcase }.each do |tag|
       fail(Puppet::ParseError, "Invalid tag #{tag.inspect}") unless 
valid_tag?(tag)
       qualified << tag if tag.include?("::")
       @tags << tag unless @tags.include?(tag)
diff --git a/spec/unit/util/tagging_spec.rb b/spec/unit/util/tagging_spec.rb
index 018871b..d43118a 100755
--- a/spec/unit/util/tagging_spec.rb
+++ b/spec/unit/util/tagging_spec.rb
@@ -45,6 +45,12 @@ describe Puppet::Util::Tagging, "when adding tags" do
     @tagger.tags.should be_include("two")
   end
 
+  it "should add all provided tags in array to the tag list" do
+    @tagger.tag(["one", "two"])
+    @tagger.tags.should be_include("one")
+    @tagger.tags.should be_include("two")
+  end
+
   it "should fail on tags containing '*' characters" do
     lambda { @tagger.tag("bad*tag") }.should raise_error(Puppet::ParseError)
   end
-- 
1.7.5.3

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