16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
|
# File 'lib/vendor/puppet/indirector/file_bucket_file/file.rb', line 16
def find( request )
checksum, files_original_path = request_to_checksum_and_path( request )
dir_path = path_for(request.options[:bucket_path], checksum)
file_path = ::File.join(dir_path, 'contents')
return nil unless ::File.exists?(file_path)
return nil unless path_match(dir_path, files_original_path)
if request.options[:diff_with]
hash_protocol = sumtype(checksum)
file2_path = path_for(request.options[:bucket_path], request.options[:diff_with], 'contents')
raise "could not find diff_with #{request.options[:diff_with]}" unless ::File.exists?(file2_path)
return `diff #{file_path.inspect} #{file2_path.inspect}`
else
contents = IO.binread(file_path)
Puppet.info "FileBucket read #{checksum}"
model.new(contents)
end
end
|