summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJesse Wolfe <jes5199@gmail.com>2010-04-09 19:18:56 -0700
committerJesse Wolfe <jes5199@gmail.com>2010-04-09 19:18:56 -0700
commite31fe8ce42ac6582507761c10472ec0d8f5dd7dc (patch)
treecba9a64c0b76b0e966854a54dff66cf3c55a1e04
parent3797c7a5af1024aaab08a905559ebd654fa978a6 (diff)
downloadpuppet-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>
-rw-r--r--lib/puppet/file_bucket/dipper.rb3
-rw-r--r--lib/puppet/file_bucket/file.rb2
-rw-r--r--lib/puppet/indirector/file_bucket_file/file.rb5
-rwxr-xr-xtest/network/client/dipper.rb2
4 files changed, 7 insertions, 5 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
diff --git a/test/network/client/dipper.rb b/test/network/client/dipper.rb
index 611ee7391..17298c45b 100755
--- a/test/network/client/dipper.rb
+++ b/test/network/client/dipper.rb
@@ -3,7 +3,7 @@
require File.dirname(__FILE__) + '/../../lib/puppettest'
require 'puppettest'
-require 'puppet/network/client/resource'
+require 'puppet/file_bucket/dipper'
class TestDipperClient < Test::Unit::TestCase
include PuppetTest::ServerTest