[Pkg-puppet-devel] [SCM] Puppet packaging for Debian branch, upstream, updated. puppet-0.24.5-rc3-1601-gf8c1b08

James Turnbull james at lovedthanlost.net
Fri Jan 15 09:07:09 UTC 2010


The following commit has been merged in the upstream branch:
commit 65f601a99a0ca7ebacfda7a6becd8af9fe9eaacb
Author: Jesse Wolfe <jes5199 at gmail.com>
Date:   Wed Nov 11 23:22:03 2009 -0800

    Fixing 2806 Specifying multiple tags fails to apply any of them
    
    Fix code that was passing an Array of code to a method that was
    expecting a single tag.
    
    Includes Markus's suggestions
    
    Signed-off-by: Jesse Wolfe <jes5199 at gmail.com>

diff --git a/lib/puppet/transaction.rb b/lib/puppet/transaction.rb
index 8ea8ccd..a0d5b16 100644
--- a/lib/puppet/transaction.rb
+++ b/lib/puppet/transaction.rb
@@ -620,8 +620,11 @@ class Transaction
 
     # Is this resource tagged appropriately?
     def missing_tags?(resource)
-        return false if self.ignore_tags? or tags.empty?
-        return true unless resource.tagged?(tags)
+        not appropriately_tagged?(resource)
+    end
+
+    def appropriately_tagged?(resource)
+        self.ignore_tags? or tags.empty? or resource.tagged?(*tags)
     end
 
     # Are there any edges that target this resource?
diff --git a/lib/puppet/util/tagging.rb b/lib/puppet/util/tagging.rb
index f421d18..03a8b8a 100644
--- a/lib/puppet/util/tagging.rb
+++ b/lib/puppet/util/tagging.rb
@@ -21,8 +21,8 @@ module Puppet::Util::Tagging
     end
 
     # Are we tagged with the provided tag?
-    def tagged?(tag)
-        defined?(@tags) and @tags.include?(tag.to_s)
+    def tagged?(*tags)
+        not ( self.tags & tags.flatten.collect { |t| t.to_s } ).empty?
     end
 
     # Return a copy of the tag list, so someone can't ask for our tags
diff --git a/spec/unit/transaction.rb b/spec/unit/transaction.rb
index 4763b98..b419d4e 100755
--- a/spec/unit/transaction.rb
+++ b/spec/unit/transaction.rb
@@ -80,6 +80,16 @@ describe Puppet::Transaction do
             @transaction.skip?(@resource).should be_true
         end
 
+        it "should ask the resource if it's tagged with any of the tags" do
+            tags = ['one', 'two']
+            @transaction.stubs(:ignore_tags?).returns(false)
+            @transaction.stubs(:tags).returns(tags)
+
+            @resource.expects(:tagged?).with(*tags).returns(true)
+
+            @transaction.missing_tags?(@resource).should be_false
+        end
+
         it "should skip not scheduled resources" do
             @transaction.stubs(:scheduled?).returns(false)
             @transaction.skip?(@resource).should be_true
diff --git a/spec/unit/util/tagging.rb b/spec/unit/util/tagging.rb
index d61ee8c..3486f46 100755
--- a/spec/unit/util/tagging.rb
+++ b/spec/unit/util/tagging.rb
@@ -89,4 +89,14 @@ describe Puppet::Util::Tagging, "when adding tags" do
     it "should indicate when the object is not tagged with a provided tag" do
         @tagger.should_not be_tagged("one")
     end
+
+    it "should indicate when the object is tagged with any tag in an array" do
+        @tagger.tag("one")
+        @tagger.should be_tagged("one","two","three")
+    end
+
+    it "should indicate when the object is not tagged with any tag in an array" do
+        @tagger.tag("one")
+        @tagger.should_not be_tagged("two","three")
+    end
 end

-- 
Puppet packaging for Debian



More information about the Pkg-puppet-devel mailing list