diff options
author | Luke Kanies <luke@madstop.com> | 2008-12-15 11:03:21 -0600 |
---|---|---|
committer | Luke Kanies <luke@madstop.com> | 2008-12-18 11:10:24 -0600 |
commit | e601babb9266258f55580fcf2a91ea5ca4c5d368 (patch) | |
tree | 13ce5396f05daf2189f6c932b486e9b1d7558bdb /lib/puppet/util/cacher.rb | |
parent | f69ac9fdb916787530fb70f00006fa64952a8d45 (diff) | |
download | puppet-e601babb9266258f55580fcf2a91ea5ca4c5d368.tar.gz puppet-e601babb9266258f55580fcf2a91ea5ca4c5d368.tar.xz puppet-e601babb9266258f55580fcf2a91ea5ca4c5d368.zip |
Supporting a nil expirer on cacher objects.
This works for those classes like Puppet::Type that use an expirer that isn't
always present (they use their catalog as an expirer).
The behaviour is now that if there is no expirer, expire() is a no-op and all
data is considered expired all the time, so it's always fresh.
Signed-off-by: Luke Kanies <luke@madstop.com>
Diffstat (limited to 'lib/puppet/util/cacher.rb')
-rw-r--r-- | lib/puppet/util/cacher.rb | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/lib/puppet/util/cacher.rb b/lib/puppet/util/cacher.rb index c1b3bad7a..a9fb890c6 100644 --- a/lib/puppet/util/cacher.rb +++ b/lib/puppet/util/cacher.rb @@ -59,7 +59,14 @@ module Puppet::Util::Cacher # Methods that get added to instances. module InstanceMethods def expire - expirer.expire + # Only expire if we have an expirer. This is + # mostly so that we can comfortably handle cases + # like Puppet::Type instances, which use their + # catalog as their expirer, and they often don't + # have a catalog. + if e = expirer + e.expire + end end def expirer |