importer.py 文件源码

python
阅读 22 收藏 0 点赞 0 评论 0

项目:foreman-yml 作者: adfinis-sygroup 项目源码 文件源码
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']))
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号