[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:03 UTC 2009


The following commit has been merged in the master branch:
commit e6698c2b8624fe2c2bbeef594318e3e8d932d345
Author: Paul Nasrat <pnasrat at googlemail.com>
Date:   Thu Sep 25 16:05:57 2008 +0100

    Add warning and forcibly set to :md5 fixing #1564

diff --git a/CHANGELOG b/CHANGELOG
index 615ff88..0de05e0 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -1,4 +1,6 @@
 0.24.x
+    Fixed #1564 - Saving File#checksum to state.yaml broken
+
     Fixed #1603 - Added support for running Puppet inside a Rack application
     (mod_rails) with Passenger and Apache
 
diff --git a/lib/puppet/type/file/checksum.rb b/lib/puppet/type/file/checksum.rb
index 3be147c..27edee1 100755
--- a/lib/puppet/type/file/checksum.rb
+++ b/lib/puppet/type/file/checksum.rb
@@ -53,6 +53,9 @@ Puppet::Type.type(:file).newproperty(:checksum) do
         else
             if FileTest.directory?(@resource[:path])
                 return :time
+            elsif @resource[:source]
+                 self.warning("Files with source set must use md5 as checksum. Forcing to md5 from %s for %s" % [ value, @resource[:path] ])
+                return :md5
             else
                 return symbolize(value)
             end
@@ -161,6 +164,7 @@ Puppet::Type.type(:file).newproperty(:checksum) do
 
         checktype = :mtime if checktype == :timestamp
         checktype = :ctime if checktype == :time
+        self.should = checktype = :md5 if @resource.property(:source)
 
         file ||= @resource[:path]
 
diff --git a/spec/unit/type/file.rb b/spec/unit/type/file.rb
index fd790d6..552d284 100755
--- a/spec/unit/type/file.rb
+++ b/spec/unit/type/file.rb
@@ -41,6 +41,14 @@ describe Puppet::Type.type(:file) do
             lambda { @file.retrieve }.should raise_error(Puppet::Error)
         end
 
+        it "should always have a checksum type of md5" do
+            File.open(@path, "w") do |f| f.puts "foo" end
+            @file[:checksum] = :mtime
+            @file.property(:checksum).checktype.should == :md5
+            @file.property(:checksum).retrieve.should == "{md5}d3b07384d113edec49eaa6238ad5ff00"
+            @file.property(:checksum).getsum(:mtime).should == "{md5}d3b07384d113edec49eaa6238ad5ff00"
+        end
+
     end
 
     describe "when retrieving remote files" do

-- 
Puppet packaging for Debian



More information about the Pkg-puppet-devel mailing list