diff options
author | Paul Berry <paul@puppetlabs.com> | 2011-01-11 11:45:58 -0800 |
---|---|---|
committer | Paul Berry <paul@puppetlabs.com> | 2011-01-11 11:45:58 -0800 |
commit | bf2b07158f5e4e16e7a1a52e84257ae5d84d9e1c (patch) | |
tree | cf51e75f954847fda264b561a7a3acdfa5869dda /lib/puppet | |
parent | e6e88e7df7fa1cbec1400d73cb7ba9428c420be0 (diff) | |
parent | a002231f45339da9b152162c2f48126d95e2e246 (diff) | |
download | puppet-bf2b07158f5e4e16e7a1a52e84257ae5d84d9e1c.tar.gz puppet-bf2b07158f5e4e16e7a1a52e84257ae5d84d9e1c.tar.xz puppet-bf2b07158f5e4e16e7a1a52e84257ae5d84d9e1c.zip |
Merge branch 'ticket/2.6.next/5171-filebucket-diff' into 2.6.next
* ticket/2.6.next/5171-filebucket-diff:
(#5171) Made filebucket able to perform diffs
Diffstat (limited to 'lib/puppet')
-rw-r--r-- | lib/puppet/indirector/file_bucket_file/file.rb | 11 | ||||
-rw-r--r-- | lib/puppet/indirector/indirection.rb | 2 | ||||
-rw-r--r-- | lib/puppet/network/http/handler.rb | 6 |
3 files changed, 16 insertions, 3 deletions
diff --git a/lib/puppet/indirector/file_bucket_file/file.rb b/lib/puppet/indirector/file_bucket_file/file.rb index 318858aaf..9d9cee793 100644 --- a/lib/puppet/indirector/file_bucket_file/file.rb +++ b/lib/puppet/indirector/file_bucket_file/file.rb @@ -15,7 +15,16 @@ module Puppet::FileBucketFile def find( request ) checksum, path = request_to_checksum_and_path( request ) - find_by_checksum( checksum, request.options ) + file = find_by_checksum( checksum, request.options ) + + if file && request.options[:diff_with] + hash_protocol = sumtype(checksum) + file2 = find_by_checksum( "{#{hash_protocol}}#{request.options[:diff_with]}", request.options ) + raise "could not find diff_with #{request.options[:diff_with]}" unless file2 + return `diff #{path_for(file).inspect}/contents #{path_for(file2).inspect}/contents` + end + + file end def save( request ) diff --git a/lib/puppet/indirector/indirection.rb b/lib/puppet/indirector/indirection.rb index 309eed7b6..a010c4e40 100644 --- a/lib/puppet/indirector/indirection.rb +++ b/lib/puppet/indirector/indirection.rb @@ -191,7 +191,7 @@ class Puppet::Indirector::Indirection # Otherwise, return the result from the terminus, caching if appropriate. if ! request.ignore_terminus? and result = terminus.find(request) - result.expiration ||= self.expiration + result.expiration ||= self.expiration if result.respond_to?(:expiration) if cache? and request.use_cache? Puppet.info "Caching #{self.name} for #{request.key}" cache.save request(:save, result, *args) diff --git a/lib/puppet/network/http/handler.rb b/lib/puppet/network/http/handler.rb index 61ae2d2fc..f22498b70 100644 --- a/lib/puppet/network/http/handler.rb +++ b/lib/puppet/network/http/handler.rb @@ -109,7 +109,11 @@ module Puppet::Network::HTTP::Handler format = format_to_use(request) set_content_type(response, format) - set_response(response, result.render(format)) + if result.respond_to?(:render) + set_response(response, result.render(format)) + else + set_response(response, result) + end end # Execute our search. |