From d812840a89092ccd04c2ad81a3bd80a6cc2f7882 Mon Sep 17 00:00:00 2001 From: luke Date: Tue, 20 Jun 2006 18:31:54 +0000 Subject: Fixing #182. Added a retry section to try reconnecting to ldap. Only one reconnect is attempted in a given search, and LDAP produces bad enough error messages that we reconnect regardless of the error thrown. git-svn-id: https://reductivelabs.com/svn/puppet/trunk@1305 980ebf18-57e1-0310-9a29-db15c13687c0 --- lib/puppet/parser/interpreter.rb | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'lib/puppet/parser') diff --git a/lib/puppet/parser/interpreter.rb b/lib/puppet/parser/interpreter.rb index 04074d695..b383f7a90 100644 --- a/lib/puppet/parser/interpreter.rb +++ b/lib/puppet/parser/interpreter.rb @@ -214,6 +214,7 @@ module Puppet classes = [] found = false + count = 0 begin # We're always doing a sub here; oh well. @ldap.search(Puppet[:ldapbase], 2, filter, sattrs) do |entry| @@ -238,7 +239,14 @@ module Puppet } end rescue => detail - raise Puppet::Error, "LDAP Search failed: %s" % detail + if count == 0 + # Try reconnecting to ldap + @ldap = nil + setup_ldap() + retry + else + raise Puppet::Error, "LDAP Search failed: %s" % detail + end end classes.flatten! -- cgit