@@ -400,10 +400,10 @@ def process(self, context, data):
400
400
# Initialize an empty LDAP record. The first LDAP record found using the ordered
401
401
# list of search filter values will be the record used.
402
402
record = None
403
+ err_msg = None
403
404
404
405
try :
405
406
connection = config ['connection' ]
406
-
407
407
for filter_val in filter_values :
408
408
if record :
409
409
break
@@ -423,17 +423,16 @@ def process(self, context, data):
423
423
satosa_logging (logger , logging .WARN , "LDAP server returned {} records using search filter value {}" .format (len (responses ), filter_val ), context .state )
424
424
record = responses [0 ]
425
425
break
426
- except LDAPException as err :
427
- satosa_logging (logger , logging .ERROR , "Caught LDAP exception: {}" .format (err ), context .state )
428
- except LdapAttributeStoreError as err :
429
- satosa_logging (logger , logging .ERROR , "Caught LDAP Attribute Store exception: {}" .format (err ), context .state )
430
- except Exception as err :
431
- satosa_logging (logger , logging .ERROR , "Caught unhandled exception: {}" .format (err ), context .state )
432
- else :
433
- err = None
434
- finally :
435
- if err :
436
- return super ().process (context , data )
426
+ except LDAPException as e :
427
+ err_msg = "Caught LDAP exception: {}" .format (e )
428
+ except LdapAttributeStoreError as e :
429
+ err_msg = "Caught LDAP Attribute Store exception: {}" .format (e )
430
+ except Exception as e :
431
+ err_msg = "Caught unhandled exception: {}" .format (e )
432
+
433
+ if err_msg :
434
+ satosa_logging (logger , logging .ERROR , err_msg , context .state )
435
+ return super ().process (context , data )
437
436
438
437
# Before using a found record, if any, to populate attributes
439
438
# clear any attributes incoming to this microservice if so configured.
0 commit comments