whimsical-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Sam Ruby <ru...@apache.org>
Subject [whimsy.git] [1/1] Commit 8745cc5: Cleanup only - no functional changes
Date Wed, 03 Feb 2016 23:23:29 GMT
Commit 8745cc5399c8bf8a13a20dd5e8a41bc59161d0cf:
    Cleanup only - no functional changes
    *) Use documented interface for getting the LDAP hostname
    *) construct equivalent ldapsearch command only once
    *) reraise exception vs raising new exception (affects stack traceback)


Branch: refs/heads/master
Author: Sam Ruby <rubys@intertwingly.net>
Committer: Sam Ruby <rubys@intertwingly.net>
Pusher: rubys <rubys@apache.org>

------------------------------------------------------------
lib/whimsy/asf/ldap.rb                                       | ++++++ ------
------------------------------------------------------------
12 changes: 6 additions, 6 deletions.
------------------------------------------------------------


diff --git a/lib/whimsy/asf/ldap.rb b/lib/whimsy/asf/ldap.rb
index 6890304..c1cc777 100644
--- a/lib/whimsy/asf/ldap.rb
+++ b/lib/whimsy/asf/ldap.rb
@@ -123,17 +123,17 @@ def self.search_one(base, filter, attrs=nil)
     init_ldap unless defined? @ldap
     return [] unless @ldap
 
-    target = @ldap.instance_variable_get('@args').join(":") rescue '?'
-
-    Wunderbar.info "[#{target}] ldapsearch -x -LLL -b #{base} -s one #{filter} " +
+    target = @ldap.get_option(LDAP::LDAP_OPT_HOST_NAME) rescue '?'
+    cmd = "ldapsearch -x -LLL -b #{base} -s one #{filter} " +
       "#{[attrs].flatten.join(' ')}"
 
+    Wunderbar.info "[#{target}] #{cmd}"
+
     begin
       result = @ldap.search2(base, ::LDAP::LDAP_SCOPE_ONELEVEL, filter, attrs)
     rescue Exception => re
-      Wunderbar.warn "[#{target}] => #{re.inspect} for ldapsearch -x -LLL -b #{base} -s
one #{filter} " +
-        "#{[attrs].flatten.join(' ')}"
-      raise re
+      Wunderbar.warn "[#{target}] => #{re.inspect} for #{cmd}"
+      raise
     end
 
     result.map! {|hash| hash[attrs]} if String === attrs

Mime
View raw message