本文整理匯總了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