本文整理汇总了Python中dsadmin.DSAdmin.agreement_dn方法的典型用法代码示例。如果您正苦于以下问题:Python DSAdmin.agreement_dn方法的具体用法?Python DSAdmin.agreement_dn怎么用?Python DSAdmin.agreement_dn使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类dsadmin.DSAdmin
的用法示例。
在下文中一共展示了DSAdmin.agreement_dn方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: setup
# 需要导入模块: from dsadmin import DSAdmin [as 别名]
# 或者: from dsadmin.DSAdmin import agreement_dn [as 别名]
def setup():
# uses an existing 389 instance
# add a suffix
# add an agreement
# This setup is quite verbose but to test dsadmin method we should
# do things manually. A better solution would be to use an LDIF.
global conn
conn = DSAdmin(**config.auth)
conn.verbose = True
conn.added_entries = []
conn.added_backends = set(['o=mockbe1'])
conn.added_replicas = []
# add a backend for testing ruv and agreements
addbackend_harn(conn, 'testReplica')
# add another backend for testing replica.add()
addbackend_harn(conn, 'testReplicaCreation')
# replication needs changelog
conn.replica.changelog()
# add rmanager entry
try:
conn.add_s(Entry((DN_RMANAGER, {
'objectclass': "top person inetOrgPerson".split(),
'sn': ["bind dn pseudo user"],
'cn': 'replication manager',
'uid': 'rmanager'
}))
)
conn.added_entries.append(DN_RMANAGER)
except ldap.ALREADY_EXISTS:
pass
# add a master replica entry
# to test ruv and agreements
replica_dn = ','.join(
['cn=replica', 'cn="o=testReplica"', DN_MAPPING_TREE])
replica_e = Entry(replica_dn)
replica_e.update({
'objectclass': ["top", "nsds5replica", "extensibleobject"],
'cn': "replica",
'nsds5replicaroot': 'o=testReplica',
'nsds5replicaid': MOCK_REPLICA_ID,
'nsds5replicatype': '3',
'nsds5flags': '1',
'nsds5replicabinddn': DN_RMANAGER
})
try:
conn.add_s(replica_e)
except ldap.ALREADY_EXISTS:
pass
conn.added_entries.append(replica_dn)
agreement_dn = ','.join(('cn=testAgreement', replica_dn))
agreement_e = Entry(agreement_dn)
agreement_e.update({
'objectclass': ["top", "nsds5replicationagreement"],
'cn': 'testAgreement',
'nsds5replicahost': 'localhost',
'nsds5replicaport': '22389',
'nsds5replicatimeout': '120',
'nsds5replicabinddn': DN_RMANAGER,
'nsds5replicacredentials': 'password',
'nsds5replicabindmethod': 'simple',
'nsds5replicaroot': 'o=testReplica',
'nsds5replicaupdateschedule': '0000-2359 0123456',
'description': 'testAgreement'
})
try:
conn.add_s(agreement_e)
except ldap.ALREADY_EXISTS:
pass
conn.added_entries.append(agreement_dn)
conn.agreement_dn = agreement_dn