summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorluke <luke@980ebf18-57e1-0310-9a29-db15c13687c0>2007-03-18 16:56:20 +0000
committerluke <luke@980ebf18-57e1-0310-9a29-db15c13687c0>2007-03-18 16:56:20 +0000
commit5257837ecb85fd37553430fe5e5030d775dbb7bb (patch)
tree4b2ad2a9f6fa494aed994be0e5051a4ace87b2e7 /lib
parenta76afb7b9298854ebbc2307c1a41adf0b8fb51b9 (diff)
downloadpuppet-5257837ecb85fd37553430fe5e5030d775dbb7bb.tar.gz
puppet-5257837ecb85fd37553430fe5e5030d775dbb7bb.tar.xz
puppet-5257837ecb85fd37553430fe5e5030d775dbb7bb.zip
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
Diffstat (limited to 'lib')
-rw-r--r--lib/puppet/network/client/master.rb18
1 files changed, 7 insertions, 11 deletions
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