def process_auth_sources_ldap(self):
log.log(log.LOG_INFO, "Processing LDAP auth sources")
for auth in self.get_config_section('auth-source-ldap'):
# validate yaml
try:
self.validator.auth_source_ldaps(auth)
except MultipleInvalid as e:
log.log(log.LOG_WARN, "Cannot create LDAP source '{0}': YAML validation Error: {1}".format(auth['name'], e))
continue
try:
as_id = self.fm.auth_source_ldaps.show(auth['name'])['id']
log.log(log.LOG_WARN, "LDAP source {0} allready exists".format(auth['name']))
continue
except TypeError:
pass
ldap_auth_obj = self.dict_underscore(auth)
try:
self.fm.auth_source_ldaps.create( auth_source_ldap=ldap_auth_obj )
except:
log.log(log.LOG_ERROR, "Something went wrong creating LDAP source {0}".format(auth['name']))
评论列表
文章目录