summaryrefslogtreecommitdiffstats
path: root/lib/puppet
diff options
context:
space:
mode:
authorLuke Kanies <luke@madstop.com>2008-04-10 14:44:14 -0500
committerLuke Kanies <luke@madstop.com>2008-04-10 14:44:14 -0500
commit738889ba027b894867209d5175c716f9a2cc54c6 (patch)
tree77e46799379d1d5654b24b0dfefdcaff2482491d /lib/puppet
parentf285f1aab525a2585532fda0b15b7fd28e994491 (diff)
downloadpuppet-738889ba027b894867209d5175c716f9a2cc54c6.tar.gz
puppet-738889ba027b894867209d5175c716f9a2cc54c6.tar.xz
puppet-738889ba027b894867209d5175c716f9a2cc54c6.zip
Fixing the expire method (it wasn't using a request
internally), and fixing the Facts class so it auto-expires any associated cached nodes when facts are saved.
Diffstat (limited to 'lib/puppet')
-rw-r--r--lib/puppet/indirector/indirection.rb6
-rwxr-xr-xlib/puppet/node/facts.rb10
2 files changed, 13 insertions, 3 deletions
diff --git a/lib/puppet/indirector/indirection.rb b/lib/puppet/indirector/indirection.rb
index ccb7ef6e7..15358a801 100644
--- a/lib/puppet/indirector/indirection.rb
+++ b/lib/puppet/indirector/indirection.rb
@@ -180,12 +180,14 @@ class Puppet::Indirector::Indirection
return nil unless cache?
- return nil unless instance = cache.find(key, *args)
+ 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(instance, *args)
+ cache.save(request(:save, instance, *args))
end
# Search for an instance in the appropriate terminus, caching the
diff --git a/lib/puppet/node/facts.rb b/lib/puppet/node/facts.rb
index c60be3fcf..8ee90b4ac 100755
--- a/lib/puppet/node/facts.rb
+++ b/lib/puppet/node/facts.rb
@@ -8,8 +8,16 @@ class Puppet::Node::Facts
# the node sources.
extend Puppet::Indirector
+ # We want to expire any cached nodes if the facts are saved.
+ module NodeExpirer
+ def save(instance, *args)
+ Puppet::Node.expire(instance.name)
+ super
+ end
+ end
+
# Use the node source as the indirection terminus.
- indirects :facts, :terminus_class => :facter
+ indirects :facts, :terminus_class => :facter, :extend => NodeExpirer
attr_accessor :name, :values