diff options
Diffstat (limited to 'lib')
| -rw-r--r-- | lib/puppet/configurer.rb | 1 | ||||
| -rw-r--r-- | lib/puppet/indirector/indirection.rb | 20 | ||||
| -rw-r--r-- | lib/puppet/resource/catalog.rb | 5 | ||||
| -rw-r--r-- | lib/puppet/util/cacher.rb | 9 |
4 files changed, 15 insertions, 20 deletions
diff --git a/lib/puppet/configurer.rb b/lib/puppet/configurer.rb index 6aeac7486..551d99684 100644 --- a/lib/puppet/configurer.rb +++ b/lib/puppet/configurer.rb @@ -194,7 +194,6 @@ class Puppet::Configurer @duration = thinmark do result = Puppet::Resource::Catalog.find(Puppet[:certname], fact_options.merge(:ignore_terminus => true)) end - Puppet.notice "Using cached catalog" result rescue => detail puts detail.backtrace if Puppet[:trace] diff --git a/lib/puppet/indirector/indirection.rb b/lib/puppet/indirector/indirection.rb index 7c3183396..97fd03ad4 100644 --- a/lib/puppet/indirector/indirection.rb +++ b/lib/puppet/indirector/indirection.rb @@ -116,7 +116,7 @@ class Puppet::Indirector::Indirection end # Set up our request object. - def request(method, key, arguments = nil) + def instantiate_request(method, key, arguments = nil) Puppet::Indirector::Request.new(self.name, method, key, arguments) end @@ -169,24 +169,24 @@ class Puppet::Indirector::Indirection # 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) - request = request(:expire, key, *args) + request = instantiate_request(:expire, key, *args) return nil unless cache? - return nil unless instance = cache.find(request(:find, key, *args)) + return nil unless instance = cache.find(instantiate_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)) + cache.save(instantiate_request(:save, instance, *args)) end # Search for an instance in the appropriate terminus, caching the # results if caching is configured.. def find(key, *args) - request = request(:find, key, *args) + request = instantiate_request(:find, key, *args) terminus = prepare(request) begin @@ -203,7 +203,7 @@ class Puppet::Indirector::Indirection result.expiration ||= self.expiration if cache? and request.use_cache? Puppet.info "Caching %s for %s" % [self.name, request.key] - cache.save request(:save, result, *args) + cache.save instantiate_request(:save, result, *args) end return terminus.respond_to?(:filter) ? terminus.filter(result) : result @@ -226,12 +226,12 @@ class Puppet::Indirector::Indirection # Remove something via the terminus. def destroy(key, *args) - request = request(:destroy, key, *args) + request = instantiate_request(:destroy, key, *args) terminus = prepare(request) result = terminus.destroy(request) - if cache? and cached = cache.find(request(:find, key, *args)) + if cache? and cached = cache.find(instantiate_request(:find, key, *args)) # Reuse the existing request, since it's equivalent. cache.destroy(request) end @@ -241,7 +241,7 @@ class Puppet::Indirector::Indirection # Search for more than one instance. Should always return an array. def search(key, *args) - request = request(:search, key, *args) + request = instantiate_request(:search, key, *args) terminus = prepare(request) if result = terminus.search(request) @@ -256,7 +256,7 @@ class Puppet::Indirector::Indirection # Save the instance in the appropriate terminus. This method is # normally an instance method on the indirected class. def save(instance, *args) - request = request(:save, instance, *args) + request = instantiate_request(:save, instance, *args) terminus = prepare(request) result = terminus.save(request) diff --git a/lib/puppet/resource/catalog.rb b/lib/puppet/resource/catalog.rb index 6f589083c..a0a871126 100644 --- a/lib/puppet/resource/catalog.rb +++ b/lib/puppet/resource/catalog.rb @@ -49,6 +49,11 @@ class Puppet::Resource::Catalog < Puppet::SimpleGraph # Some metadata to help us compile and generally respond to the current state. attr_accessor :client_version, :server_version + def expired? + return false if Puppet[:use_cached_catalog] + super + end + # Add classes to our class list. def add_class(*classes) classes.each do |klass| diff --git a/lib/puppet/util/cacher.rb b/lib/puppet/util/cacher.rb index 28786ab53..3c9d24db9 100644 --- a/lib/puppet/util/cacher.rb +++ b/lib/puppet/util/cacher.rb @@ -18,15 +18,6 @@ module Puppet::Util::Cacher extend Expirer - # Our module has been extended in a class; we can only add the Instance methods, - # which become *class* methods in the class. - def self.extended(other) - class << other - extend ClassMethods - include InstanceMethods - end - end - # Our module has been included in a class, which means the class gets the class methods # and all of its instances get the instance methods. def self.included(other) |
