summaryrefslogtreecommitdiffstats
path: root/lib/puppet/parser
diff options
context:
space:
mode:
authorluke <luke@980ebf18-57e1-0310-9a29-db15c13687c0>2006-06-20 18:31:54 +0000
committerluke <luke@980ebf18-57e1-0310-9a29-db15c13687c0>2006-06-20 18:31:54 +0000
commitd812840a89092ccd04c2ad81a3bd80a6cc2f7882 (patch)
tree20a0002e2e48f061a45663dc7557cc3c2badf707 /lib/puppet/parser
parent46824cd8167e2d07ba1f1bdb0cc24789b3a565b1 (diff)
downloadpuppet-d812840a89092ccd04c2ad81a3bd80a6cc2f7882.tar.gz
puppet-d812840a89092ccd04c2ad81a3bd80a6cc2f7882.tar.xz
puppet-d812840a89092ccd04c2ad81a3bd80a6cc2f7882.zip
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
Diffstat (limited to 'lib/puppet/parser')
-rw-r--r--lib/puppet/parser/interpreter.rb10
1 files changed, 9 insertions, 1 deletions
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!