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