[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:06:57 UTC 2010

The following commit has been merged in the upstream branch:
commit 136949da70f1a6715734faa6ac3c464f386fccfb
Author: Jesse Wolfe <jes5199 at gmail.com>
Date:   Wed Nov 4 17:57:20 2009 -0800

    Fixing #2631 show_diff sometimes doesn't happen
    This patch fixes a code-path in Puppet::Type::File::Content#insync? that
    was failing to show a diff when the content's source came from a
    I was only able to reproduce one of the two such failures that Malcolm
    Howe reported, but I think it's likely that they were both caused by
    this same bug.
    Signed-off-by: Jesse Wolfe <jes5199 at gmail.com>

diff --git a/lib/puppet/type/file/content.rb b/lib/puppet/type/file/content.rb
index 7f19083..36e6c41 100755
--- a/lib/puppet/type/file/content.rb
+++ b/lib/puppet/type/file/content.rb
@@ -96,7 +96,7 @@ module Puppet
             return true if ! @resource.replace?
             if self.should
-                return super
+                result = super
             elsif source = resource.parameter(:source)
                 fail "Got a remote source with no checksum" unless source.checksum
                 result = (is == source.checksum)
diff --git a/spec/unit/type/file/content.rb b/spec/unit/type/file/content.rb
index 901d52d..442de13 100755
--- a/spec/unit/type/file/content.rb
+++ b/spec/unit/type/file/content.rb
@@ -197,6 +197,26 @@ describe content do
                 @content.must be_insync("{md5}" + Digest::MD5.hexdigest("some content"))
+            describe "and Puppet[:show_diff] is set" do
+                before do
+                    Puppet[:show_diff] = true
+                end
+                it "should display a diff if the current contents are different from the desired content" do 
+                    @content.should = "some content"
+                    @content.expects(:string_file_diff).once
+                    @content.insync?("other content")
+                end
+                it "should not display a diff if the sum for the current contents is the same as the sum for the desired content" do 
+                    @content.should = "some content"
+                    @content.expects(:string_file_diff).never
+                    @content.insync?("{md5}" + Digest::MD5.hexdigest("some content"))
+                end
+            end
             describe "and the content is specified via a remote source" do
                 before do
                     @metadata = stub 'metadata'

Puppet packaging for Debian

More information about the Pkg-puppet-devel mailing list