summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorluke <luke@980ebf18-57e1-0310-9a29-db15c13687c0>2006-03-12 01:49:37 +0000
committerluke <luke@980ebf18-57e1-0310-9a29-db15c13687c0>2006-03-12 01:49:37 +0000
commit08b36ccd05ac2e29e651ec3eb787fc6a6afb5bee (patch)
treea0000b217211dd5eb37473e6757770d4a670dd00
parent97913d4fb67d43e39c5317a4b4bc8d2a461df7e3 (diff)
downloadpuppet-08b36ccd05ac2e29e651ec3eb787fc6a6afb5bee.tar.gz
puppet-08b36ccd05ac2e29e651ec3eb787fc6a6afb5bee.tar.xz
puppet-08b36ccd05ac2e29e651ec3eb787fc6a6afb5bee.zip
Adding enhancement #92. Unfortunately, I was not able to write test code to consistently verify that this works, because there is too much caching internally. I verified it personally using my own configurations, but that is as good as I could do. This indicates that caching should probably be rethought, so that there is some kind of global "do not cache anything" mechanism.
git-svn-id: https://reductivelabs.com/svn/puppet/trunk@1009 980ebf18-57e1-0310-9a29-db15c13687c0
-rw-r--r--lib/puppet/client/master.rb22
1 files changed, 19 insertions, 3 deletions
diff --git a/lib/puppet/client/master.rb b/lib/puppet/client/master.rb
index 48f3cef1d..cb2d6f444 100644
--- a/lib/puppet/client/master.rb
+++ b/lib/puppet/client/master.rb
@@ -2,7 +2,13 @@
class Puppet::Client::MasterClient < Puppet::Client
Puppet.setdefaults("puppetd",
:puppetdlockfile => [ "$statedir/puppetdlock",
- "A lock file to temporarily stop puppetd from doing anything."]
+ "A lock file to temporarily stop puppetd from doing anything."],
+ :usecacheonfailure => [true,
+ "Whether to use the cached configuration when the remote
+ configuration will not compile. This option is useful for testing
+ new configurations, where you want to fix the broken configuration
+ rather than reverting to a known-good one."
+ ]
)
@drivername = :Master
@@ -176,6 +182,12 @@ class Puppet::Client::MasterClient < Puppet::Client
textobjects = @driver.getconfig(textfacts, "yaml")
rescue => detail
Puppet.err "Could not retrieve configuration: %s" % detail
+
+ unless Puppet[:usecacheonfailure]
+ @objects = nil
+ Puppet.warning "Not using cache on failed configuration"
+ return
+ end
end
fromcache = false
@@ -188,11 +200,12 @@ class Puppet::Client::MasterClient < Puppet::Client
end
Puppet.warning "Could not get config; using cached copy"
fromcache = true
+ else
+ @configstamp = Time.now.to_i
end
begin
textobjects = CGI.unescape(textobjects)
- @configstamp = Time.now.to_i
rescue => detail
raise Puppet::Error, "Could not CGI.unescape configuration"
end
@@ -260,7 +273,10 @@ class Puppet::Client::MasterClient < Puppet::Client
Puppet[:puppetdlockfile]
else
self.getconfig
- self.apply
+
+ if defined? @objects and @objects
+ self.apply
+ end
end
end