diff options
| author | luke <luke@980ebf18-57e1-0310-9a29-db15c13687c0> | 2007-03-19 16:42:41 +0000 |
|---|---|---|
| committer | luke <luke@980ebf18-57e1-0310-9a29-db15c13687c0> | 2007-03-19 16:42:41 +0000 |
| commit | e2c5dbb2cc022034a54b1207310eff43be93ce85 (patch) | |
| tree | 53c71082cf67f6847f8611fcd5f09fb11c9a8d37 /lib/puppet/network/client | |
| parent | 92bad78a6aebb9abeac8e734b5ce56b88e21cdda (diff) | |
| download | puppet-e2c5dbb2cc022034a54b1207310eff43be93ce85.tar.gz puppet-e2c5dbb2cc022034a54b1207310eff43be93ce85.tar.xz puppet-e2c5dbb2cc022034a54b1207310eff43be93ce85.zip | |
Another round of bug-fixes, prompted by test logs from David Schmitt
git-svn-id: https://reductivelabs.com/svn/puppet/trunk@2316 980ebf18-57e1-0310-9a29-db15c13687c0
Diffstat (limited to 'lib/puppet/network/client')
| -rw-r--r-- | lib/puppet/network/client/master.rb | 63 |
1 files changed, 43 insertions, 20 deletions
diff --git a/lib/puppet/network/client/master.rb b/lib/puppet/network/client/master.rb index 6ae7d55b3..d568b8ae7 100644 --- a/lib/puppet/network/client/master.rb +++ b/lib/puppet/network/client/master.rb @@ -128,27 +128,27 @@ class Puppet::Network::Client::Master < Puppet::Network::Client end end - # Have the facts changed since we last compiled? - def facts_changed?(facts) - oldfacts = Puppet::Util::Storage.cache(:configuration)[:facts] - newfacts = self.class.facts - if oldfacts == newfacts - return false - else - return true - end - end - # Check whether our configuration is up to date def fresh?(facts) - return false if Puppet[:ignorecache] - return false unless self.compile_time - return false if self.facts_changed?(facts) + if Puppet[:ignorecache] + Puppet.notice "Ignoring cache" + return false + end + unless self.compile_time + Puppet.debug "No cached compile time" + return false + end + if facts_changed?(facts) + Puppet.info "Facts have changed; recompiling" + return false + end # We're willing to give a 2 second drift - if @driver.freshness - @compile_time.to_i < 1 + newcompile = @driver.freshness + if newcompile - @compile_time.to_i < 1 return true else + Puppet.debug "Server compile time is %s vs %s" % [newcompile, @compile_time] return false end end @@ -174,12 +174,15 @@ class Puppet::Network::Client::Master < Puppet::Network::Client if self.objects or FileTest.exists?(self.cachefile) if self.fresh?(facts) Puppet.info "Config is up to date" - begin - @objects = YAML.load(self.retrievecache).to_type - rescue => detail - Puppet.warning "Could not load cached configuration: %s" % detail + unless self.objects + oldtext = self.retrievecache + begin + @objects = YAML.load(oldtext).to_type + rescue => detail + Puppet.warning "Could not load cached configuration: %s" % detail + end + return end - return end end Puppet.debug("getting config") @@ -513,6 +516,26 @@ class Puppet::Network::Client::Master < Puppet::Network::Client loadfacts() private + + # Have the facts changed since we last compiled? + def facts_changed?(facts) + oldfacts = Puppet::Util::Storage.cache(:configuration)[:facts] + newfacts = facts + if oldfacts == newfacts + return false + else +# unless oldfacts +# puts "no old facts" +# return true +# end +# newfacts.keys.each do |k| +# unless newfacts[k] == oldfacts[k] +# puts "%s: %s vs %s" % [k, newfacts[k], oldfacts[k]] +# end +# end + return true + end + end # Actually retrieve the configuration, either from the server or from a # local master. |
