本文整理汇总了Python中bug_harness.DSAdminHarness.createInstance方法的典型用法代码示例。如果您正苦于以下问题:Python DSAdminHarness.createInstance方法的具体用法?Python DSAdminHarness.createInstance怎么用?Python DSAdminHarness.createInstance使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类bug_harness.DSAdminHarness
的用法示例。
在下文中一共展示了DSAdminHarness.createInstance方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1:
# 需要导入模块: from bug_harness import DSAdminHarness [as 别名]
# 或者: from bug_harness.DSAdminHarness import createInstance [as 别名]
m1replargs = {
'suffix': basedn,
'bename': "userRoot",
'binddn': "cn=replrepl,cn=config",
'bindcn': "replrepl",
'bindpw': "replrepl",
'log' : False
}
m2replargs = m1replargs
os.environ['USE_VALGRIND'] = "1"
m1 = DSAdmin.createInstance({
'newrootpw': 'password',
'newhost': host1,
'newport': port1,
'newinst': 'm1',
'newsuffix': basedn,
'verbose': False,
'no_admin': True
})
del os.environ['USE_VALGRIND']
m2 = DSAdmin.createInstance({
'newrootpw': 'password',
'newhost': host2,
'newport': port2,
'newinst': 'm2',
'newsuffix': basedn,
'verbose': False,
'no_admin': True
})
示例2: MAY
# 需要导入模块: from bug_harness import DSAdminHarness [as 别名]
# 或者: from bug_harness.DSAdminHarness import createInstance [as 别名]
'SchemaFile': schemafile
}, replargs
)
#os.environ['USE_VALGRIND'] = ''
#os.environ.pop('USE_VALGRIND')
#try:
# foo = os.environ['USE_VALGRIND']
#except KeyError:
# print "should no longer have USE_VALGRIND env. var"
if useds:
ad = DSAdmin.createInstance({
'newrootpw': rootpw2,
'newhost': host2,
'newport': port2,
'newinst': 'ad',
'newsuffix': suffix,
'verbose': False,
'no_admin': True
})
print "Fake AD needs extra schema . . ."
oidnum = 10000000
ad.addAttr("( 2.16.840.1.113730.3.1.%d NAME 'samAccountName' DESC 'AD uid attribute' SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 SINGLE-VALUE )" % oidnum)
oidnum = oidnum + 1
ad.addAttr("( 2.16.840.1.113730.3.1.%d NAME 'objectGUID' DESC 'AD uuid attribute' SYNTAX 1.3.6.1.4.1.1466.115.121.1.5 SINGLE-VALUE )" % oidnum)
oidnum = oidnum + 1
ad.addAttr("( 2.16.840.1.113730.3.1.%d NAME 'userAccountControl' DESC 'AD user account control' SYNTAX 1.3.6.1.4.1.1466.115.121.1.27 SINGLE-VALUE )" % oidnum)
oidnum = oidnum + 1
ad.addObjClass("( 2.16.840.1.113730.3.2.%d NAME 'adPerson' DESC 'AD person mixin' SUP top AUXILIARY MAY ( samAccountName $ objectGUID $ name $ userAccountControl ) )" % oidnum)
oidnum = oidnum + 1
ad.addAttr("( 2.16.840.1.113730.3.1.%d NAME 'groupType' DESC 'AD group type' SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 SINGLE-VALUE X-ORIGIN 'Netscape NT Synchronization' )" % oidnum)
示例3:
# 需要导入模块: from bug_harness import DSAdminHarness [as 别名]
# 或者: from bug_harness.DSAdminHarness import createInstance [as 别名]
"suffix": basedn,
"bename": "userRoot",
"binddn": "cn=replrepl,cn=config",
"bindcn": "replrepl",
"bindpw": "replrepl",
"pd": 5,
"log": False,
}
m2replargs = m1replargs
m1 = DSAdmin.createInstance(
{
"newrootpw": "password",
"newhost": host1,
"newport": port1,
"newinst": "m1",
"newsuffix": basedn,
"verbose": True,
"no_admin": True,
}
)
# os.environ['USE_GDB'] = "1"
m2 = DSAdmin.createInstance(
{
"newrootpw": "password",
"newhost": host2,
"newport": port2,
"newinst": "m2",
"newsuffix": basedn,
"verbose": False,
示例4:
# 需要导入模块: from bug_harness import DSAdminHarness [as 别名]
# 或者: from bug_harness.DSAdminHarness import createInstance [as 别名]
import ldap
host1 = "localhost.localdomain"
host2 = host1
port1 = 1130
port2 = port1+10
rootdn1 = "cn=directory manager"
rootpw1 = 'password'
rootdn2 = rootdn1
rootpw2 = rootpw1
suffix = "dc=example,dc=com"
mux = DSAdmin.createInstance({
'newrootpw': rootpw1,
'newhost': host1,
'newport': port1,
'newinst': 'mux',
'newsuffix': 'dc=notused',
'no_admin': True
})
os.environ['USE_GDB'] = "1"
farm = DSAdmin.createInstance({
'newrootpw': rootpw2,
'newhost': host2,
'newport': port2,
'newinst': 'farm',
'newsuffix': 'dc=notused',
'no_admin': True
})
# add the suffix
示例5: SimpleLDAPObject
# 需要导入模块: from bug_harness import DSAdminHarness [as 别名]
# 或者: from bug_harness.DSAdminHarness import createInstance [as 别名]
import tempfile
from ldap.ldapobject import SimpleLDAPObject
import pprint
host1 = "localhost.localdomain"
port1 = 1110
basedn = 'dc=example,dc=com'
ldapifilepath = os.environ.get('PREFIX', "") + "/var/run/slapd-srv.socket"
os.environ['USE_GDB'] = "1"
srv = DSAdmin.createInstance({
'newrootpw': 'password',
'newhost': host1,
'newport': port1,
'newinst': 'srv',
'newsuffix': basedn,
'no_admin': True,
'ldapifilepath': ldapifilepath
})
del os.environ['USE_GDB']
ldapiurl = ldapurl.LDAPUrl(None, "ldapi", ldapifilepath)
conn = SimpleLDAPObject(ldapiurl.initializeUrl())
print "connecting to", ldapiurl.initializeUrl()
conn.simple_bind_s("cn=directory manager", "password")
ents = conn.search_s("", ldap.SCOPE_BASE)
pprint.pprint(ents)
示例6: Entry
# 需要导入模块: from bug_harness import DSAdminHarness [as 别名]
# 或者: from bug_harness.DSAdminHarness import createInstance [as 别名]
import time
import ldap
import pprint
import base64, hashlib
host1 = "localhost.localdomain"
cfgport = 1100
port1 = cfgport + 30
basedn = 'dc=example,dc=com'
newinst = 'ds'
os.environ['USE_GDB'] = "1"
srv = DSAdmin.createInstance({
'newrootpw': 'password',
'newhost': host1,
'newport': port1,
'newinst': newinst,
'newsuffix': basedn,
'no_admin': True
})
userdn = "ou=people," + basedn
# make password
password = "password"
sha = hashlib.sha1(password)
hashedpw = "{SHA}" + base64.b64encode(sha.digest()) + '\n' # add extra bogus newline
# add user entry
dn = "cn=foo," + userdn
ent = Entry(dn)
ent.setValues('objectclass', 'person')
示例7:
# 需要导入模块: from bug_harness import DSAdminHarness [as 别名]
# 或者: from bug_harness.DSAdminHarness import createInstance [as 别名]
import sys
import time
import ldap
host1 = "USEFQDN"
port1 = 1200
secport1 = port1 + 1
basedn = "dc=example,dc=com"
# os.environ['USE_DBX'] = "1"
srv = DSAdmin.createInstance(
{
"newrootpw": "password",
"newhost": host1,
"newport": port1,
"newinst": "srv",
"newsuffix": basedn,
"verbose": False,
"no_admin": True,
}
)
# del os.environ['USE_DBX']
srv.setupSSL(secport1, os.environ["SECDIR"], {"nsslapd-security": "on"})
m1.replicaSetupAll(m1replargs)
m2.replicaSetupAll(m2replargs)
initfile = ""
if os.environ.has_key("SERVER_ROOT"):
initfile = "%s/slapd-%s/ldif/Example.ldif" % (m1.sroot, m1.inst)
示例8:
# 需要导入模块: from bug_harness import DSAdminHarness [as 别名]
# 或者: from bug_harness.DSAdminHarness import createInstance [as 别名]
import os
import ldap
host1 = "localhost.localdomain"
host2 = host1
cfgport = 1100
port1 = cfgport + 30
port2 = port1 + 10
#os.environ['USE_DBX'] = "1"
m1 = DSAdmin.createInstance({
'newrootpw': 'password',
'newhost': host1,
'newport': port1,
'newinst': 'm1',
'newsuffix': 'dc=example,dc=com',
'verbose': True,
'no_admin': True
})
#del os.environ['USE_DBX']
initfile = ''
if os.environ.has_key('SERVER_ROOT'):
initfile = "%s/slapd-%s/ldif/Example.ldif" % (m1.sroot,m1.inst)
else:
initfile = "%s/share/dirsrv/data/Example.ldif" % os.environ.get('PREFIX', '/usr')
m1.importLDIF(initfile, '', "userRoot", True)
#m1.setLogLevel(65535)