From a892ed08cdca2da71e1112cdf32ae20e536f1c81 Mon Sep 17 00:00:00 2001 From: Dan Scott Date: Mon, 5 Dec 2011 11:44:30 -0500 Subject: [PATCH] LDAP: More robust processing and error reporting Don't die if we don't have an lulColleagueId; spit out the attributes that we have ready at hand to help identify the problem record. Signed-off-by: Dan Scott --- tools/patron-load/ldap_osrf_sync | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/tools/patron-load/ldap_osrf_sync b/tools/patron-load/ldap_osrf_sync index eee82ddcbe..4fb5a57e2b 100755 --- a/tools/patron-load/ldap_osrf_sync +++ b/tools/patron-load/ldap_osrf_sync @@ -133,6 +133,10 @@ class User: Map LDAP record to Evergreen identity type and value """ + if 'lulColleagueId' not in self.ldap_atts: + print >> sys.stderr, 'No lulColleagueId for %s' % (self.ldap_atts) + return 2, 'NO_COLLEAGUE_ID' + ident_value = self.ldap_atts['lulColleagueId'][0].strip().lower() if len(ident_value) != 7: print >> sys.stderr, 'Datatel number not 7 chars for %s (%s)' % ( @@ -175,7 +179,7 @@ class User: return profile_map[affiliation] else: print >> sys.stderr, "Affiliation '%s' not mapped to a profile " \ - "for user %s" % (affiliation, self.usrname) + "for user %s" % (affiliation, self.ldap_atts) return None def get_home_ou(self): -- 2.11.0