當前位置: 首頁>>代碼示例>>Python>>正文


Python DSAdminHarness.setupBackend方法代碼示例

本文整理匯總了Python中bug_harness.DSAdminHarness.setupBackend方法的典型用法代碼示例。如果您正苦於以下問題:Python DSAdminHarness.setupBackend方法的具體用法?Python DSAdminHarness.setupBackend怎麽用?Python DSAdminHarness.setupBackend使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在bug_harness.DSAdminHarness的用法示例。


在下文中一共展示了DSAdminHarness.setupBackend方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: setupBackend

# 需要導入模塊: from bug_harness import DSAdminHarness [as 別名]
# 或者: from bug_harness.DSAdminHarness import setupBackend [as 別名]
    def setupBackend(self, suffix, binddn=None, bindpw=None, urls=None, attrvals=None, benamebase=None, verbose=False):
        """Create a backends using the first available cn."""
        # if benamebase is set, try creating without appending
        if benamebase:
            benum = 0
        else:
            benum = 1

        # figure out what type of be based on args
        if binddn and bindpw and urls:  # its a chaining be
            benamebase = benamebase or "chaindb"
        else:  # its a ldbm be
            benamebase = benamebase or "localdb"

        done = False
        while not done:
            # if benamebase is set, benum starts at 0
            # and the first attempt tries to create the
            # simple benamebase. On failure benum is
            # incremented and the suffix is appended
            # to the cn
            if benum:
                benamebase_tmp = benamebase + str(benum)  # e.g. localdb1
            else:
                benamebase_tmp = benamebase

            try:
                cn = DSAdmin.setupBackend(suffix, binddn, bindpw,
                                          urls, attrvals, benamebase, verbose)
                done = True
            except ldap.ALREADY_EXISTS:
                benum += 1

        return cn
開發者ID:ioggstream,項目名稱:lib389,代碼行數:36,代碼來源:bug_harness.py


注:本文中的bug_harness.DSAdminHarness.setupBackend方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。