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


Python lib389.DirSrv类代码示例

本文整理汇总了Python中lib389.DirSrv的典型用法代码示例。如果您正苦于以下问题:Python DirSrv类的具体用法?Python DirSrv怎么用?Python DirSrv使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: topology

def topology(request):
    '''
        This fixture is used to standalone topology for the 'module'.
        At the beginning, It may exists a standalone instance.
        It may also exists a backup for the standalone instance.
    '''
    standalone = DirSrv(verbose=False)

    # Args for the standalone instance
    args_instance[SER_HOST] = HOST_STANDALONE
    args_instance[SER_PORT] = PORT_STANDALONE
    args_instance[SER_SERVERID_PROP] = SERVERID_STANDALONE
    args_standalone = args_instance.copy()
    standalone.allocate(args_standalone)

    # Get the status of the instance and restart it if it exists
    instance_standalone = standalone.exists()
    if instance_standalone:
        standalone.delete()

    # Create the instance
    standalone.create()

    # Used to retrieve configuration information (dbdir, confdir...)
    standalone.open()

    def fin():
        standalone.delete()
    request.addfinalizer(fin)

    return TopologyStandalone(standalone)
开发者ID:Firstyear,项目名称:ds,代码行数:31,代码来源:ticket47828_test.py

示例2: topology

def topology(request):
    """This fixture is used to standalone topology for the 'module'."""

    standalone = DirSrv(verbose=False)

    # Args for the standalone instance
    args_instance[SER_HOST] = HOST_STANDALONE
    args_instance[SER_PORT] = PORT_STANDALONE
    args_instance[SER_SERVERID_PROP] = SERVERID_STANDALONE
    args_standalone = args_instance.copy()
    standalone.allocate(args_standalone)

    # Get the status of the instance and restart it if it exists
    instance_standalone = standalone.exists()

    # Remove the instance
    if instance_standalone:
        standalone.delete()

    # Create the instance
    standalone.create()

    # Used to retrieve configuration information (dbdir, confdir...)
    standalone.open()

    # Delete each instance in the end
    def fin():
        standalone.delete()
    request.addfinalizer(fin)

    # Here we have standalone instance up and running
    return TopologyStandalone(standalone)
开发者ID:Firstyear,项目名称:ds,代码行数:32,代码来源:basic_test.py

示例3: topology

def topology(request):
    """
        This fixture is used to create a DirSrv instance for the 'module'.
    """
    schemainst = DirSrv(verbose=False)

    # Args for the master instance
    args_instance[SER_HOST] = HOST_STANDALONE
    args_instance[SER_PORT] = PORT_STANDALONE
    args_instance[SER_SERVERID_PROP] = SERVERID_STANDALONE
    schemainst.allocate(args_instance)

    # Remove all the instance
    if schemainst.exists():
        schemainst.delete()

    # Create the instance
    schemainst.create()
    schemainst.open()

    def fin():
        schemainst.delete()

    request.addfinalizer(fin)

    return TopologyStandalone(schemainst)
开发者ID:Firstyear,项目名称:ds,代码行数:26,代码来源:test_schema.py

示例4: getConnection

def getConnection(binddn='', password='', saslmethod=None):

    dir_srv_conn = DirSrv(verbose=False)
    headers = request.headers
    inst = {}

    print(headers)
    #
    # Parse the headers looking for host name
    #
    # We need to prefix these with LDAP, because host is reserved for HTTP
    # things.
    inst[SER_HOST] = headers.get('ldaphost', socket.gethostname())

    try:
        inst[SER_PORT] = int(headers.get('ldapport', '389'))
    except ValueError:
        inst[SER_PORT] = 389

    inst[SER_SERVERID_PROP] = headers.get('ldapinst', None)

    # We need apache to determine this, not us. Set to simple
    # saslmethod = str(headers.get('ldapsaslmethod', None))

    # Get certificate database directory name
    # don't wrap this in str, else bad things happen :)
    certdir = headers.get('ldapcertdir', None)

    inst[SER_ROOT_DN] = binddn
    inst[SER_ROOT_PW] = password
    dir_srv_conn.allocate(inst)
    dir_srv_conn.open(saslmethod, certdir)

    return dir_srv_conn
开发者ID:Firstyear,项目名称:rest389,代码行数:34,代码来源:Authentication.py

示例5: topology

def topology(request):
    global installation1_prefix
    if installation1_prefix:
        args_instance[SER_DEPLOYED_DIR] = installation1_prefix

    # Creating standalone instance ...
    standalone = DirSrv(verbose=False)
    args_instance[SER_HOST] = HOST_STANDALONE
    args_instance[SER_PORT] = PORT_STANDALONE
    args_instance[SER_SERVERID_PROP] = SERVERID_STANDALONE
    args_instance[SER_CREATION_SUFFIX] = DEFAULT_SUFFIX
    args_standalone = args_instance.copy()
    standalone.allocate(args_standalone)
    instance_standalone = standalone.exists()
    if instance_standalone:
        standalone.delete()
    standalone.create()
    standalone.open()

    def fin():
        standalone.delete()

    request.addfinalizer(fin)

    return TopologyStandalone(standalone)
开发者ID:Firstyear,项目名称:ds,代码行数:25,代码来源:db2ldif_test.py

示例6: setup

def setup():
    global conn
    conn = DirSrv(**config.auth)
    conn.verbose = True
    conn.added_entries = []
    conn.added_backends = set(['o=mockbe2'])
    conn.added_replicas = []
    harn_nolog()
开发者ID:Firstyear,项目名称:lib389,代码行数:8,代码来源:dsadmin_test.py

示例7: setup

def setup():
    global conn
    try:
        conn = DirSrv(**config.auth)
        conn.verbose = True
        conn.added_entries = []
    except SERVER_DOWN, e:
        log.error("To run tests you need a working 389 instance %s" % config.auth)
        raise e
开发者ID:ioggstream,项目名称:lib389,代码行数:9,代码来源:dsadmin_basic_test.py

示例8: openConnection

 def openConnection(self, inst):
     # Open a new connection to our LDAP server
     server = DirSrv(verbose=False)
     args_instance[SER_HOST] = inst.host
     args_instance[SER_PORT] = inst.port
     args_instance[SER_SERVERID_PROP] = inst.serverid
     args_standalone = args_instance.copy()
     server.allocate(args_standalone)
     server.open()
     return server
开发者ID:Firstyear,项目名称:ds,代码行数:10,代码来源:cleanallruv_test.py

示例9: openConnection

def openConnection(inst):
    # Open a new connection to our LDAP server
    server = DirSrv(verbose=False)
    args_instance[SER_HOST] = HOST_STANDALONE
    args_instance[SER_PORT] = PORT_STANDALONE
    args_instance[SER_SERVERID_PROP] = SERVERID_STANDALONE
    args_standalone = args_instance.copy()
    server.allocate(args_standalone)
    server.open()

    return server
开发者ID:Firstyear,项目名称:ds,代码行数:11,代码来源:stress_tests.py

示例10: topology

def topology(request):
    instance = DirSrv(verbose=False)

    if instance.exists():
        instance.delete()

    def fin():
        if instance.exists():
            instance.delete()
    request.addfinalizer(fin)

    return TopologyInstance(instance)
开发者ID:Firstyear,项目名称:lib389,代码行数:12,代码来源:dirsrv_test.py

示例11: setup

def setup():
    # uses an existing 389 instance
    # add a suffix
    # add an agreement
    # This setup is quite verbose but to test DirSrv method we should
    # do things manually. A better solution would be to use an LDIF.
    global conn
    conn = DirSrv(**config.auth)
    conn.verbose = True
    conn.added_entries = []
    conn.added_backends = set(['o=mockbe1'])
    conn.added_replicas = []
    """
开发者ID:Firstyear,项目名称:lib389,代码行数:13,代码来源:config_test.py

示例12: setUp

 def setUp(self):
     instance = DirSrv(verbose=False)
     instance.log.debug("Instance allocated")
     args = {SER_HOST:          LOCALHOST,
             SER_PORT:          INSTANCE_PORT,
             SER_DEPLOYED_DIR:  INSTANCE_PREFIX,
             SER_SERVERID_PROP: INSTANCE_SERVERID
             }
     instance.allocate(args)
     if instance.exists():
         instance.delete()
     instance.create()
     instance.open()
     self.instance = instance
开发者ID:ioggstream,项目名称:lib389,代码行数:14,代码来源:mappingTree_test.py

示例13: topology

def topology(request):
    instance = DirSrv(verbose=False)
    instance.log.debug("Instance allocated")
    args = {SER_HOST: LOCALHOST,
            SER_PORT: INSTANCE_PORT,
            SER_SERVERID_PROP: INSTANCE_SERVERID}
    instance.allocate(args)
    if instance.exists():
        instance.delete()
    instance.create()
    instance.open()

    def fin():
        instance.delete()
    request.addfinalizer(fin)

    return TopologyInstance(instance)
开发者ID:Firstyear,项目名称:lib389,代码行数:17,代码来源:mappingTree_test.py

示例14: topology

def topology(request):
    standalone = DirSrv(verbose=False)
    standalone.log.debug('Instance allocated')
    args = {SER_HOST: LOCALHOST,
            SER_PORT: INSTANCE_PORT,
            SER_SERVERID_PROP: INSTANCE_SERVERID}
    standalone.allocate(args)
    if standalone.exists():
        standalone.delete()
    standalone.create()
    standalone.open()

    def fin():
        standalone.delete()
    request.addfinalizer(fin)

    return TopologyStandalone(standalone)
开发者ID:Firstyear,项目名称:lib389,代码行数:17,代码来源:dereference_test.py

示例15: test_finalizer

def test_finalizer():
    # for each defined instance, remove it
    for args_instance in ALL_INSTANCES:
        instance = DirSrv(verbose=True)
        instance.allocate(args_instance)
        if instance.exists():
            instance.delete()

        # remove any existing backup for this instance
        instance.clearBackupFS()
开发者ID:Firstyear,项目名称:ds,代码行数:10,代码来源:finalizer.py


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