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


Python DSAdmin.modify_s方法代码示例

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


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

示例1: DSAdmin

# 需要导入模块: from dsadmin import DSAdmin [as 别名]
# 或者: from dsadmin.DSAdmin import modify_s [as 别名]
print "Replication started"

print "Press Enter to continue . . ."
foo = sys.stdin.readline()

print "modify entry on m1"
dn = "uid=scarter,ou=people,dc=example,dc=com"
mod = [(ldap.MOD_ADD, 'description', 'description')]
m1.modify_s(dn, mod)
c1.waitForEntry(dn, 10, 'description')

print "Modify entry on c1"
dn = "uid=jvedder,ou=people,dc=example,dc=com"
cc1 = DSAdmin(host2, port2, dn, "befitting")
mod = [(ldap.MOD_REPLACE, 'telephonenumber', '123456789')]
cc1.modify_s(dn, mod)
print "Wait for mod to show up on m1"
time.sleep(10)

ents = m1.search_s(dn, ldap.SCOPE_BASE, '(objectclass=*)', ['telephonenumber'])
ent = ents[0]
if ent.telephonenumber == '123456789':
    print "m1 success - telephonenumber changed"
else:
    print "m1 failed - value is still " + ent.telephonenumber
ents = c1.search_s(dn, ldap.SCOPE_BASE, '(objectclass=*)', ['telephonenumber'])
ent = ents[0]
if ent.telephonenumber == '123456789':
    print "c1 success - telephonenumber changed"
else:
    print "c1 failed - value is still " + ent.telephonenumber
开发者ID:CACloudAdmin,项目名称:scripts,代码行数:33,代码来源:chainonupdate.py

示例2: xrange

# 需要导入模块: from dsadmin import DSAdmin [as 别名]
# 或者: from dsadmin.DSAdmin import modify_s [as 别名]
time.sleep(5)

print "repl status:", ds.getReplStatus(agmtdn)

for ii in xrange(1,6):
    ent = makeADUserEnt(ii)
    try: ad.add_s(ent)
    except ldap.ALREADY_EXISTS:
        print "AD entry", ent.dn, "already exists"
    setWindowsPwd(ad, ent.dn)
    kk = ii % len(userAcctVals)
    mod = []
    for attr, val in userAcctVals[kk].iteritems():
        mod.append((ldap.MOD_REPLACE, attr, str(val)))
    ad.modify_s(ent.dn, mod)

for ii in xrange(6,11):
    ent = makeDSUserEnt(ii)
    try: ds.add_s(ent)
    except ldap.ALREADY_EXISTS:
        print "DS entry", ent.dn, "already exists"

print "Wait for sync to happen . . ."
time.sleep(syncinterval+1)

print "with ipa, new ds users are not added to AD - so we must add them now to AD in order for them to sync . . ."
for ii in xrange(6,11):
    ent = makeADUserEnt(ii)
    try: ad.add_s(ent)
    except ldap.ALREADY_EXISTS:
开发者ID:CACloudAdmin,项目名称:scripts,代码行数:32,代码来源:winsyncmove.py

示例3: str

# 需要导入模块: from dsadmin import DSAdmin [as 别名]
# 或者: from dsadmin.DSAdmin import modify_s [as 别名]
       (ldap.MOD_ADD, 'ntUserDomainId', uid)]
ds.modify_s(ent.dn, mod)
time.sleep(1)
print "Added ntuser, changing telephonenumber . . ."
mod = [(ldap.MOD_DELETE, 'telephoneNumber', telnum1),
       (ldap.MOD_ADD, 'telephoneNumber', telnum2)]
ds.modify_s(ent.dn, mod)
time.sleep(1)
print "changed telephonenumber, changing description . . ."
mod = [(ldap.MOD_ADD, 'description', 'test bug471068')]
ds.modify_s(ent.dn, mod)
time.sleep(1)

print "Delete description in AD, then in DS . . ."
mod = [(ldap.MOD_DELETE, 'description', None)]
ad.modify_s(adent.dn, mod)
ds.modify_s(ent.dn, mod)

time.sleep(1)
print "Add description in AD, then in DS . . ."
mod = [(ldap.MOD_ADD, 'description', 'test bug471068')]
ad.modify_s(adent.dn, mod)
ds.modify_s(ent.dn, mod)

time.sleep(1)
print "Now compare the entries . . ."
ents = ds.search_s(suffix, scope, "(uid=%s)" % uid)
print "DS Entry: ", str(ents[0])
ents = ad.search_s(suffix, scope, "(samaccountname=%s)" % uid)
print "AD Entry: ", str(ents[0])
开发者ID:CACloudAdmin,项目名称:scripts,代码行数:32,代码来源:bug471068.py


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