diff options
| author | Markus Roberts <Markus@reality.com> | 2010-03-29 17:16:05 -0700 |
|---|---|---|
| committer | test branch <puppet-dev@googlegroups.com> | 2010-02-17 06:50:53 -0800 |
| commit | 49be54e5d4c5c19ec1f7e5e454666bb59ebfe88f (patch) | |
| tree | a3efe74b49b771200e9a45b59961266083107434 /lib/puppet/indirector | |
| parent | e69b7db9124b9b1cd65ab89a2f5c6968928f256d (diff) | |
| download | puppet-49be54e5d4c5c19ec1f7e5e454666bb59ebfe88f.tar.gz puppet-49be54e5d4c5c19ec1f7e5e454666bb59ebfe88f.tar.xz puppet-49be54e5d4c5c19ec1f7e5e454666bb59ebfe88f.zip | |
Revert the guts of #2890
This patch reverts the semantically significant parts of #2890 due to the
issues discussed on #3360 (security concerns when used with autosign,
inconsistency between REST & XMLRPC semantics) but leaves the semantically
neutral changes (code cleanup, added tests) in place.
This patch is intended for 0.25.x, but may also be applied as a step in the
resolution of #3450 (refactored #2890, add "remove_certs" flag) in Rolwf.
Diffstat (limited to 'lib/puppet/indirector')
| -rw-r--r-- | lib/puppet/indirector/indirection.rb | 29 |
1 files changed, 16 insertions, 13 deletions
diff --git a/lib/puppet/indirector/indirection.rb b/lib/puppet/indirector/indirection.rb index 266758b84..35f17768e 100644 --- a/lib/puppet/indirector/indirection.rb +++ b/lib/puppet/indirector/indirection.rb @@ -161,19 +161,22 @@ class Puppet::Indirector::Indirection end end - # Expire a cached object, if one is cached. Note that we now actually - # remove it if possible, and only mark it as expired if destroy isn't - # supported. + # Expire a cached object, if one is cached. Note that we don't actually + # remove it, we expire it and write it back out to disk. This way people + # can still use the expired object if they want. def expire(key, *args) - if cache? and instance = cache.find(request(:find, key, *args)) - Puppet.info "Expiring the #{name} cache of #{instance.name}" - if cache.respond_to? :destroy - cache.destroy(request(:destroy, instance, *args)) - else - instance.expiration = Time.now - 1 - cache.save(request(:save,instance,*args)) - end - end + request = request(:expire, key, *args) + + return nil unless cache? + + return nil unless instance = cache.find(request(:find, key, *args)) + + Puppet.info "Expiring the %s cache of %s" % [self.name, instance.name] + + # Set an expiration date in the past + instance.expiration = Time.now - 60 + + cache.save(request(:save, instance, *args)) end # Search for an instance in the appropriate terminus, caching the @@ -213,7 +216,7 @@ class Puppet::Indirector::Indirection return nil end - Puppet.debug "Using cached #{name} for #{request.key}, good until #{cached.expiration}" + Puppet.debug "Using cached %s for %s" % [self.name, request.key] return cached end |
