From 413432e16343b7b41b34bfa19af86bacb0a4ee91 Mon Sep 17 00:00:00 2001 From: Steve Kemp Date: Thu, 16 Apr 2015 10:13:33 +0100 Subject: Fixed to be valid. Due to some sloppy edits this module was not correct. --- lib/custodian/protocoltest/ldap.rb | 29 ++++++++++++++--------------- 1 file changed, 14 insertions(+), 15 deletions(-) diff --git a/lib/custodian/protocoltest/ldap.rb b/lib/custodian/protocoltest/ldap.rb index baabd7f..4509ee0 100644 --- a/lib/custodian/protocoltest/ldap.rb +++ b/lib/custodian/protocoltest/ldap.rb @@ -126,27 +126,26 @@ module Custodian @error = "failed to bind to LDAP server '#{@host}' with username '#{@ldap_user}' and password '#{@ldap_pass}'" return false end + rescue LDAP::ResultError => ex + @error = "LDAP exception: #{ex} when talking to LDAP server '#{@host}' with username '#{@ldap_user}' and password '#{@ldap_pass}'" + return false end - rescue LDAP::ResultError => ex - @error = "LDAP exception: #{ex} when talking to LDAP server '#{@host}' with username '#{@ldap_user}' and password '#{@ldap_pass}'" - return false - end - - @error = "LDAP server test failed against '#{@host}' with username '#{@ldap_user}' and password '#{@ldap_pass}'" - false - end + @error = "LDAP server test failed against '#{@host}' with username '#{@ldap_user}' and password '#{@ldap_pass}'" + false + end - # - # If the test fails then report the error. - # - def error - @error - end + # + # If the test fails then report the error. + # + def error + @error + end - register_test_type 'ldap' + register_test_type 'ldap' + end end end -- cgit v1.2.1