diff options
author | Markus Roberts <Markus@reality.com> | 2009-10-19 21:51:32 -0700 |
---|---|---|
committer | James Turnbull <james@lovedthanlost.net> | 2009-11-13 18:34:37 +1100 |
commit | adc0a4ed939a717e8735485d493bde28ceab5ac0 (patch) | |
tree | 3d8191c9d84a94a47859b194c3cc79eed83db33f /lib/puppet | |
parent | 65f601a99a0ca7ebacfda7a6becd8af9fe9eaacb (diff) | |
download | puppet-adc0a4ed939a717e8735485d493bde28ceab5ac0.tar.gz puppet-adc0a4ed939a717e8735485d493bde28ceab5ac0.tar.xz puppet-adc0a4ed939a717e8735485d493bde28ceab5ac0.zip |
Fix for #2661 and related issues
If setup code for a process depends on network connectivity
it needs to be protected with a rescue clause as much as the
main body of the process.
Further, Timeout exceptions aren't under StandardError and thus
aren't caught by an un-typed rescue clause. This doesn't matter
if we've morphed the exception, but will cause the program to
fail if we haven't.
There are many places where these concerns _might_ cause a problem
but in most cases they never will in practice; this patch addresses
the five cases where I have been able to confirm that it actually
can cause the client daemon to exit and two more where I suspect
(but can not prove) that it could.
This is an extension of the prior patch to cover additional cases
found by automated testing (repeated catalog runs with a 1% chance
of timeout forced on all timeout-bound operations, ~5000 runs).
The new cases recurred multiple times (>100 each) and in a final pass
with these corrected (~2500 runs) no additional cases were found.
Diffstat (limited to 'lib/puppet')
-rw-r--r-- | lib/puppet/agent.rb | 4 | ||||
-rw-r--r-- | lib/puppet/configurer.rb | 2 | ||||
-rw-r--r-- | lib/puppet/configurer/fact_handler.rb | 5 | ||||
-rw-r--r-- | lib/puppet/indirector/ldap.rb | 2 |
4 files changed, 6 insertions, 7 deletions
diff --git a/lib/puppet/agent.rb b/lib/puppet/agent.rb index a188df39e..789660585 100644 --- a/lib/puppet/agent.rb +++ b/lib/puppet/agent.rb @@ -51,7 +51,7 @@ class Puppet::Agent with_client do |client| begin sync.synchronize { lock { client.run(*args) } } - rescue => detail + rescue Exception => detail puts detail.backtrace if Puppet[:trace] Puppet.err "Could not run %s: %s" % [client_class, detail] end @@ -122,7 +122,7 @@ class Puppet::Agent def with_client begin @client = client_class.new - rescue => detail + rescue Exception => detail puts detail.backtrace if Puppet[:trace] Puppet.err "Could not create instance of %s: %s" % [client_class, detail] return diff --git a/lib/puppet/configurer.rb b/lib/puppet/configurer.rb index 12726e778..3e72fa574 100644 --- a/lib/puppet/configurer.rb +++ b/lib/puppet/configurer.rb @@ -93,7 +93,7 @@ class Puppet::Configurer duration = thinmark do result = catalog_class.find(name, fact_options.merge(:ignore_cache => true)) end - rescue => detail + rescue Exception => detail puts detail.backtrace if Puppet[:trace] Puppet.err "Could not retrieve catalog from remote server: %s" % detail end diff --git a/lib/puppet/configurer/fact_handler.rb b/lib/puppet/configurer/fact_handler.rb index 8e0fef71d..cbb627680 100644 --- a/lib/puppet/configurer/fact_handler.rb +++ b/lib/puppet/configurer/fact_handler.rb @@ -11,14 +11,13 @@ module Puppet::Configurer::FactHandler end def find_facts - reload_facter() - # This works because puppetd configures Facts to use 'facter' for # finding facts and the 'rest' terminus for caching them. Thus, we'll # compile them and then "cache" them on the server. begin + reload_facter() Puppet::Node::Facts.find(Puppet[:certname]) - rescue => detail + rescue Exception => detail puts detail.backtrace if Puppet[:trace] raise Puppet::Error, "Could not retrieve local facts: %s" % detail end diff --git a/lib/puppet/indirector/ldap.rb b/lib/puppet/indirector/ldap.rb index 51bab0e6e..744a8394e 100644 --- a/lib/puppet/indirector/ldap.rb +++ b/lib/puppet/indirector/ldap.rb @@ -1,4 +1,4 @@ -require 'puppet/indirector/terminus' +requir 'puppet/indirector/terminus' require 'puppet/util/ldap/connection' class Puppet::Indirector::Ldap < Puppet::Indirector::Terminus |