diff options
author | luke <luke@980ebf18-57e1-0310-9a29-db15c13687c0> | 2006-04-28 16:18:21 +0000 |
---|---|---|
committer | luke <luke@980ebf18-57e1-0310-9a29-db15c13687c0> | 2006-04-28 16:18:21 +0000 |
commit | 94caa8a48f32ed1fd3aa38dc43e2add97026fcf2 (patch) | |
tree | 407fdab60a044b42c94e6fcce5d30c4df7067a18 | |
parent | bcfc469e4aa36ab8b98af57b1314e26d5d7a0a18 (diff) | |
download | puppet-94caa8a48f32ed1fd3aa38dc43e2add97026fcf2.tar.gz puppet-94caa8a48f32ed1fd3aa38dc43e2add97026fcf2.tar.xz puppet-94caa8a48f32ed1fd3aa38dc43e2add97026fcf2.zip |
Fixing #128. md5lite was being used instead of full md5. At this point, md5lite cannot be used for source copies.
git-svn-id: https://reductivelabs.com/svn/puppet/trunk@1146 980ebf18-57e1-0310-9a29-db15c13687c0
-rwxr-xr-x | lib/puppet/server/fileserver.rb | 5 | ||||
-rw-r--r-- | lib/puppet/type/pfile.rb | 2 | ||||
-rwxr-xr-x | lib/puppet/type/pfile/checksum.rb | 10 | ||||
-rw-r--r-- | test/types/file.rb | 26 |
4 files changed, 36 insertions, 7 deletions
diff --git a/lib/puppet/server/fileserver.rb b/lib/puppet/server/fileserver.rb index c0d1303fa..ef35365a8 100755 --- a/lib/puppet/server/fileserver.rb +++ b/lib/puppet/server/fileserver.rb @@ -60,11 +60,6 @@ class Server return "" end - #if links == :ignore and obj[:type] == "link" - # mount.info "Ignoring link %s" % obj.name - # return "" - #end - desc = [] CHECKPARAMS.each { |check| if state = obj.state(check) diff --git a/lib/puppet/type/pfile.rb b/lib/puppet/type/pfile.rb index 08f003f8c..1ea3473d9 100644 --- a/lib/puppet/type/pfile.rb +++ b/lib/puppet/type/pfile.rb @@ -833,6 +833,8 @@ module Puppet end # And then update our checksum, so the next run doesn't find it. + # FIXME This is extra work, because it's going to read the whole + # file back in again. self.setchecksum end end # Puppet.type(:pfile) diff --git a/lib/puppet/type/pfile/checksum.rb b/lib/puppet/type/pfile/checksum.rb index e43bb3d74..02e2e5761 100755 --- a/lib/puppet/type/pfile/checksum.rb +++ b/lib/puppet/type/pfile/checksum.rb @@ -138,11 +138,17 @@ module Puppet begin File.open(@parent[:path]) { |file| text = nil - if checktype == "md5" + case checktype + when :md5 text = file.read - else + Puppet.info "Reading all of %s with %s" % + [@parent.name, checktype.inspect] + when :md5lite + Puppet.info "Reading a small part of %s with %s" % + [@parent.name, checktype.inspect] text = file.read(512) end + if text.nil? self.debug "Not checksumming empty file %s" % @parent[:path] diff --git a/test/types/file.rb b/test/types/file.rb index 04993db82..2eeb2b2a5 100644 --- a/test/types/file.rb +++ b/test/types/file.rb @@ -1116,6 +1116,32 @@ class TestFile < Test::Unit::TestCase assert_equal(0440, filemode(bucketedpath)) end + + def test_largefilechanges + source = tempfile() + dest = tempfile() + + # Now make a large file + File.open(source, "w") { |f| + 500.times { |i| f.puts "line %s" % i } + } + + obj = Puppet::Type.type(:file).create( + :name => dest, :source => source + ) + + assert_events([:file_created], obj) + + File.open(source, File::APPEND|File::WRONLY) { |f| f.puts "another line" } + + assert_events([:file_changed], obj) + + # Now modify the dest file + File.open(dest, File::APPEND|File::WRONLY) { |f| f.puts "one more line" } + + assert_events([:file_changed, :file_changed], obj) + + end end # $Id$ |