[Pkg-puppet-devel] [SCM] Puppet packaging for Debian branch, experimental, updated. debian/2.6.8-1-844-g7ec39d5

Matt Robinson matt at puppetlabs.com
Tue May 10 08:03:02 UTC 2011


The following commit has been merged in the experimental branch:
commit 094a5c85fc9b4b1bd00f14193abdf23839905dc7
Author: Steve Nielson <steve at nielsenhq.com>
Date:   Mon Nov 22 14:58:31 2010 -0500

    (#5211) Added patch and tests for checking the size of the arrary which is returned

diff --git a/lib/puppet/provider/augeas/augeas.rb b/lib/puppet/provider/augeas/augeas.rb
index 7dbd062..4619682 100644
--- a/lib/puppet/provider/augeas/augeas.rb
+++ b/lib/puppet/provider/augeas/augeas.rb
@@ -213,7 +213,12 @@ Puppet::Type.type(:augeas).provide(:augeas) do
       fail("Invalid command: #{cmd_array.join(" ")}") if clause_array.length != 2
       comparator = clause_array.shift
       arg = clause_array.shift
-      return_value = (result.size.send(comparator, arg))
+      case comparator
+      when "!="
+        return_value = !(result.size.send(:==, arg))
+      else
+        return_value = (result.size.send(comparator, arg))
+      end
     when "include"
       arg = clause_array.shift
       return_value = result.include?(arg)
diff --git a/spec/unit/provider/augeas/augeas_spec.rb b/spec/unit/provider/augeas/augeas_spec.rb
index 07b6320..0cedbdb 100644
--- a/spec/unit/provider/augeas/augeas_spec.rb
+++ b/spec/unit/provider/augeas/augeas_spec.rb
@@ -316,6 +316,30 @@ describe provider_class do
       provider.stubs(:get_augeas_version).returns("0.3.5")
       provider.need_to_run?.should == false
     end
+
+    #Ticket 5211 testing
+    it "should return true when a size != the provided value" do
+      resource = stub("resource")
+      resource.stubs(:[]).returns(false).then.returns("match path size != 17").then.returns("")
+      provider = provider_class.new(resource)
+      augeas_stub = stub("augeas", :match => ["set", "of", "values"])
+      augeas_stub.stubs("close")
+      provider.aug= augeas_stub
+      provider.stubs(:get_augeas_version).returns("0.3.5")
+      provider.need_to_run?.should == true
+    end
+
+    #Ticket 5211 testing
+    it "should return false when a size doeas equal the provided value" do
+      resource = stub("resource")
+      resource.stubs(:[]).returns(false).then.returns("match path size != 3").then.returns("")
+      provider = provider_class.new(resource)
+      augeas_stub = stub("augeas", :match => ["set", "of", "values"])
+      augeas_stub.stubs("close")
+      provider.aug= augeas_stub
+      provider.stubs(:get_augeas_version).returns("0.3.5")
+      provider.need_to_run?.should == false
+    end
   end
 
   describe "augeas execution integration" do

-- 
Puppet packaging for Debian



More information about the Pkg-puppet-devel mailing list