3371-If-lite-is-not-specified-we-hand-the-reading-of-the.patch

Steve McIntosh, 09/02/2008 09:49 pm

Download (1.5 kB)

b/lib/puppet/util/checksums.rb
61 61

  
62 62
    private
63 63

  
64
    # Perform an incremental checksum on a file.
64
    # Perform an incremental checksum on a file if 
65
    # requested. Otherwise let the digest read the
66
    # file in and process it (slightly quicker).
65 67
    def checksum_file(digest, filename, lite = false)
66
        File.open(filename, 'r') do |file|
67
            while content = file.read(512)
68
                digest << content
69
                break if lite
68
        if lite
69
            File.open(filename, 'r') do |file|
70
                while content = file.read(512)
71
                    digest << content
72
                    break if lite
73
                end
70 74
            end
75
        else
76
            digest.file(filename)
71 77
        end
72

  
73 78
        return digest.hexdigest
74 79
    end
75 80
end
76
-