当前位置: 首页>>代码示例>>Python>>正文


Python DSAdmin.getBackendsForSuffix方法代码示例

本文整理汇总了Python中dsadmin.DSAdmin.getBackendsForSuffix方法的典型用法代码示例。如果您正苦于以下问题:Python DSAdmin.getBackendsForSuffix方法的具体用法?Python DSAdmin.getBackendsForSuffix怎么用?Python DSAdmin.getBackendsForSuffix使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在dsadmin.DSAdmin的用法示例。


在下文中一共展示了DSAdmin.getBackendsForSuffix方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: default_test

# 需要导入模块: from dsadmin import DSAdmin [as 别名]
# 或者: from dsadmin.DSAdmin import getBackendsForSuffix [as 别名]
def default_test():
    host = 'localhost'
    port = 10200
    binddn = "cn=directory manager"
    bindpw = "password"
    suffix = 'dc=example,dc=com'
    basedn = DN_CONFIG
    scope = ldap.SCOPE_BASE
    filt = "(objectclass=*)"
    instance_name = ['m1', 'm2']

    instance_config = {
        'cfgdshost': host,
        'cfgdsport': port,
        'cfgdsuser': 'admin',
        'cfgdspwd': 'admin',
        'newrootpw': 'password',
        'newhost': host,
        'newport': port,
        'newinstance': instance_name[0],
        'newsuffix': suffix,
        'setup_admin': True,
    }
    try:
        m1 = DSAdmin(host, port, binddn, bindpw)
    except:
        m1 = DSAdminTools.createInstance(instance_config, verbose=1)
        added_instances.append(instance_config['newinstance'])

#        filename = "%s/slapd-%s/ldif/Example.ldif" % (m1.sroot, m1.inst)
#        m1.importLDIF(filename, "dc=example,dc=com", None, True)
#        m1.exportLDIF('/tmp/ldif', "dc=example,dc=com", False, True)
    print m1.sroot, m1.inst, m1.errlog
    ent = m1.getEntry(basedn, scope, filt, None)
    if ent:
        print ent.passwordmaxage
    instance_config.update({
                           'newinstance': instance_name[1],
                           'newport': port + 10,

                           })
    m1 = DSAdminTools.createInstance(instance_config, verbose=1)
    added_instances.append(instance_config['newinstance'])
#     m1.stop(True)
#     m1.start(True)
    cn = m1.setupBackend("dc=example2,dc=com")
    rc = m1.setupSuffix("dc=example2,dc=com", cn)
    entry = m1.getEntry(DN_CONFIG, ldap.SCOPE_SUBTREE, "(cn=" + cn + ")")
    print "new backend entry is:"
    print entry
    print entry.getValues('objectclass')
    print entry.OBJECTCLASS
    results = m1.search_s("cn=monitor", ldap.SCOPE_SUBTREE)
    print results
    results = m1.getBackendsForSuffix("dc=example,dc=com")
    print results

    print "done"
开发者ID:danielino,项目名称:dsadmin,代码行数:60,代码来源:dsadmin_create_remove_test.py


注:本文中的dsadmin.DSAdmin.getBackendsForSuffix方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。