Catch traceback when LDAP returns something other than the nested tuple

This commit is contained in:
C. R. Oldham 2016-03-22 10:59:37 -06:00
parent 4af4280d04
commit c57a232809

View File

@ -407,8 +407,14 @@ def expand_ldap_entries(entries, opts=None):
search_string,
['cn'])
for ldap_match in search_results:
minion_id = ldap_match[1]['cn'][0].lower()
retrieved_minion_ids.append(minion_id)
try:
minion_id = ldap_match[1]['cn'][0].lower()
retrieved_minion_ids.append(minion_id)
except TypeError:
# TypeError here just means that one of the returned
# entries didn't match the format we expected
# from LDAP.
pass
for minion_id in retrieved_minion_ids:
acl_tree.append({minion_id: permissions})