diff options
author | luke <luke@980ebf18-57e1-0310-9a29-db15c13687c0> | 2007-03-19 01:44:44 +0000 |
---|---|---|
committer | luke <luke@980ebf18-57e1-0310-9a29-db15c13687c0> | 2007-03-19 01:44:44 +0000 |
commit | 61b34906552ca4bd46f9a07dec419a44bac94652 (patch) | |
tree | 7647474ac30c22167d978ad2ba31a23789b3a2b9 /lib | |
parent | 5f7ae353a0ca9cadaf8fdc8803e1227ee6583d25 (diff) | |
download | puppet-61b34906552ca4bd46f9a07dec419a44bac94652.tar.gz puppet-61b34906552ca4bd46f9a07dec419a44bac94652.tar.xz puppet-61b34906552ca4bd46f9a07dec419a44bac94652.zip |
Fixing the fact caching so that facts are only downloaded and retrieved once, rather than once during fresh checking and once during config compile.
git-svn-id: https://reductivelabs.com/svn/puppet/trunk@2304 980ebf18-57e1-0310-9a29-db15c13687c0
Diffstat (limited to 'lib')
-rw-r--r-- | lib/puppet/network/client/master.rb | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/lib/puppet/network/client/master.rb b/lib/puppet/network/client/master.rb index 506ed09e8..518110a63 100644 --- a/lib/puppet/network/client/master.rb +++ b/lib/puppet/network/client/master.rb @@ -128,7 +128,7 @@ class Puppet::Network::Client::Master < Puppet::Network::Client end # Have the facts changed since we last compiled? - def facts_changed? + def facts_changed?(facts) oldfacts = Puppet::Util::Storage.cache(:configuration)[:facts] newfacts = self.class.facts if oldfacts == newfacts @@ -139,10 +139,10 @@ class Puppet::Network::Client::Master < Puppet::Network::Client end # Check whether our configuration is up to date - def fresh? + def fresh?(facts) return false if Puppet[:ignorecache] return false unless self.compile_time - return false if self.facts_changed? + return false if self.facts_changed?(facts) # We're willing to give a 2 second drift if @driver.freshness - @compile_time.to_i < 1 @@ -167,8 +167,11 @@ class Puppet::Network::Client::Master < Puppet::Network::Client # use the cached copy. def getconfig dostorage() + + facts = self.class.facts + if self.objects or FileTest.exists?(self.cachefile) - if self.fresh? + if self.fresh?(facts) Puppet.info "Config is up to date" begin @objects = YAML.load(self.retrievecache).to_type @@ -185,8 +188,6 @@ class Puppet::Network::Client::Master < Puppet::Network::Client getplugins() end - facts = self.class.facts - unless facts.length > 0 raise Puppet::Network::ClientError.new( "Could not retrieve any facts" |