Improve debug output
authorDan Scott <dscott@laurentian.ca>
Wed, 7 Oct 2015 21:17:59 +0000 (17:17 -0400)
committerDan Scott <dscott@laurentian.ca>
Wed, 7 Oct 2015 21:17:59 +0000 (17:17 -0400)
For some exceptions, we don't get a message object with an info key, so
be more tolerant.

Also, dump the DN when we dump the general data.

Signed-off-by: Dan Scott <dscott@laurentian.ca>
tools/patron-load/ldap_osrf_sync

index ed3243b..75a1c81 100755 (executable)
@@ -330,6 +330,7 @@ def find_ldap_users(con, ldap_filter, attributes, auth):
             user = User(raw_user, raw_atts)
             if ARGS.dump_ldap:
                 dump_data(raw_atts)
+                print("dn = '%s'" % (raw_user))
             if ARGS.create_users:
                 res = create_evergreen_user(auth, user)
                 if res:
@@ -690,7 +691,8 @@ def main(args=None):
         results = ldap_query(con, AUTHTOKEN)
 
     except ldap.LDAPError, exc:
-        print >> sys.stderr, "Could not connect: " + exc.message['info']
+        print >> sys.stderr, "Could not connect: "
+        print >> sys.stderr, exc.message
         if type(exc.message) == dict and exc.message.has_key('desc'):
             print >> sys.stderr, exc.message['desc']
         else: