Last active
December 29, 2015 19:46
-
-
Save bodgix/0dfa6308d9747248b5ef to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
begin # start catching exceptions here | |
Net::LDAP.open( | |
:host => host, | |
:port => port, | |
:auth => { | |
:method => :simple, | |
:username => CONFIG['repldn'], | |
:password => CONFIG['replpw'] | |
} | |
) do |ldap| | |
unless ldap.bind | |
LOG.warn "connected to #{host}:#{port} but bind failed." | |
exit 3 | |
end | |
# Bind was succesful, let's use the server from now on. | |
# I want to end the exception handling block, but I'm in a nested block now | |
# How to do that without ending the block to whom ldap was yielded? | |
ldap.search() | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment