From 5257837ecb85fd37553430fe5e5030d775dbb7bb Mon Sep 17 00:00:00 2001 From: luke Date: Sun, 18 Mar 2007 16:56:20 +0000 Subject: Fixing #491 -- the client correctly realizes when the cache file is missing and only considers the config to be in sync if that is not the case. git-svn-id: https://reductivelabs.com/svn/puppet/trunk@2288 980ebf18-57e1-0310-9a29-db15c13687c0 --- lib/puppet/network/client/master.rb | 18 +++++++----------- 1 file changed, 7 insertions(+), 11 deletions(-) (limited to 'lib') diff --git a/lib/puppet/network/client/master.rb b/lib/puppet/network/client/master.rb index b244478c2..7553a62c7 100644 --- a/lib/puppet/network/client/master.rb +++ b/lib/puppet/network/client/master.rb @@ -102,9 +102,9 @@ class Puppet::Network::Client::Master < Puppet::Network::Client end def clear - #@objects = nil @objects.remove(true) Puppet::Type.allclear + @objects = nil end # Initialize and load storage @@ -155,16 +155,16 @@ class Puppet::Network::Client::Master < Puppet::Network::Client # use the cached copy. def getconfig dostorage() - if self.fresh? - Puppet.info "Config is up to date" - unless defined? @objects + if self.objects or FileTest.exists?(self.cachefile) + if self.fresh? + 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 end + return end - return end Puppet.debug("getting config") @@ -194,13 +194,9 @@ class Puppet::Network::Client::Master < Puppet::Network::Client self.setclasses(objects.classes) # Clear all existing objects, so we can recreate our stack. - if defined? @objects - Puppet::Type.allclear - - # Make sure all of the objects are really gone. - @objects.remove(true) + if self.objects + clear() end - @objects = nil # Now convert the objects to real Puppet objects @objects = objects.to_type -- cgit