diff options
| author | Paul Berry <paul@puppetlabs.com> | 2011-02-21 12:50:53 -0800 |
|---|---|---|
| committer | Paul Berry <paul@puppetlabs.com> | 2011-02-21 13:53:02 -0800 |
| commit | dcce45cfcbf77d576237ae8ff0ffa6ef98dcb722 (patch) | |
| tree | bbb656f24a5e4c01eaaee0688b43299053426f8c /lib/puppet/file_bucket | |
| parent | bca53bd4dcaf39a09f91c32ff56ef3b0a60dc85c (diff) | |
(#6353) Restore the ability to store paths in the filebucket
Commit 2274d5104f6e413a2b8899a3c3111a17bbb2f4d7 optimized network
usage for the case where a file is already in the filebucket.
However, it took away the ability to store paths.
This change restores the ability to store paths while maintaining
optimal network usage for the case where the file is already in the
filebucket with the given path. This is expected to be the most
common case.
Paired-with: Jesse Wolfe <jesse@puppetlabs.com>
Diffstat (limited to 'lib/puppet/file_bucket')
| -rw-r--r-- | lib/puppet/file_bucket/dipper.rb | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/lib/puppet/file_bucket/dipper.rb b/lib/puppet/file_bucket/dipper.rb index f4bef28a8..de4c01b78 100644 --- a/lib/puppet/file_bucket/dipper.rb +++ b/lib/puppet/file_bucket/dipper.rb @@ -34,11 +34,12 @@ class Puppet::FileBucket::Dipper contents = ::File.read(file) begin file_bucket_file = Puppet::FileBucket::File.new(contents, :bucket_path => @local_path) - dest_path = "#{@rest_path}#{file_bucket_file.name}" + files_original_path = absolutize_path(file) + dest_path = "#{@rest_path}#{file_bucket_file.name}#{files_original_path}" # Make a HEAD request for the file so that we don't waste time # uploading it if it already exists in the bucket. - unless Puppet::FileBucket::File.head("#{@rest_path}#{file_bucket_file.checksum_type}/#{file_bucket_file.checksum_data}") + unless Puppet::FileBucket::File.head("#{@rest_path}#{file_bucket_file.checksum_type}/#{file_bucket_file.checksum_data}#{files_original_path}") file_bucket_file.save(dest_path) end |
