diff options
author | Jesse Wolfe <jes5199@gmail.com> | 2010-04-09 19:18:56 -0700 |
---|---|---|
committer | Jesse Wolfe <jes5199@gmail.com> | 2010-04-09 19:18:56 -0700 |
commit | e31fe8ce42ac6582507761c10472ec0d8f5dd7dc (patch) | |
tree | cba9a64c0b76b0e966854a54dff66cf3c55a1e04 /lib/puppet | |
parent | 3797c7a5af1024aaab08a905559ebd654fa978a6 (diff) | |
download | puppet-e31fe8ce42ac6582507761c10472ec0d8f5dd7dc.tar.gz puppet-e31fe8ce42ac6582507761c10472ec0d8f5dd7dc.tar.xz puppet-e31fe8ce42ac6582507761c10472ec0d8f5dd7dc.zip |
Fix a failure in new FileBucket where it was impossible to read from a
bucket with a non-default path.
Signed-off-by: Jesse Wolfe <jes5199@gmail.com>
Diffstat (limited to 'lib/puppet')
-rw-r--r-- | lib/puppet/file_bucket/dipper.rb | 3 | ||||
-rw-r--r-- | lib/puppet/file_bucket/file.rb | 2 | ||||
-rw-r--r-- | lib/puppet/indirector/file_bucket_file/file.rb | 5 |
3 files changed, 6 insertions, 4 deletions
diff --git a/lib/puppet/file_bucket/dipper.rb b/lib/puppet/file_bucket/dipper.rb index b4a9eb83d..d9239e865 100644 --- a/lib/puppet/file_bucket/dipper.rb +++ b/lib/puppet/file_bucket/dipper.rb @@ -49,8 +49,9 @@ class Puppet::FileBucket::Dipper # Retrieve a file by sum. def getfile(sum) source_path = "#{@rest_path}md5/#{sum}" - file_bucket_file = Puppet::FileBucket::File.find(source_path) + file_bucket_file = Puppet::FileBucket::File.find(source_path, :bucket_path => @local_path) + raise Puppet::Error, "File not found" unless file_bucket_file return file_bucket_file.to_s end diff --git a/lib/puppet/file_bucket/file.rb b/lib/puppet/file_bucket/file.rb index 7122bfbbb..1e95e5ef6 100644 --- a/lib/puppet/file_bucket/file.rb +++ b/lib/puppet/file_bucket/file.rb @@ -13,7 +13,7 @@ class Puppet::FileBucket::File attr :paths, true attr :contents, true attr :checksum_type - attr :bucket_path + attr :bucket_path, true def self.default_checksum_type :md5 diff --git a/lib/puppet/indirector/file_bucket_file/file.rb b/lib/puppet/indirector/file_bucket_file/file.rb index d32533dd3..4c08b8d6b 100644 --- a/lib/puppet/indirector/file_bucket_file/file.rb +++ b/lib/puppet/indirector/file_bucket_file/file.rb @@ -11,7 +11,7 @@ module Puppet::FileBucketFile def find( request ) checksum, path = request_to_checksum_and_path( request ) - return find_by_checksum( checksum ) + return find_by_checksum( checksum, request.options ) end def save( request ) @@ -27,8 +27,9 @@ module Puppet::FileBucketFile private - def find_by_checksum( checksum ) + def find_by_checksum( checksum, options ) model.new( nil, :checksum => checksum ) do |bucket_file| + bucket_file.bucket_path = options[:bucket_path] filename = contents_path_for( bucket_file ) if ! ::File.exist? filename |