mirror of
https://salsa.debian.org/freeipa-team/freeipa.git
synced 2025-02-25 18:55:28 -06:00
Replace setValue by keyword arguments when creating entries
Part of the work for: https://fedorahosted.org/freeipa/ticket/2660
This commit is contained in:
parent
6896626baa
commit
3dd4b36e1a
@ -326,23 +326,26 @@ class ADTRUSTInstance(service.Service):
|
||||
try:
|
||||
self.admin_conn.getEntry(new_dn, ldap.SCOPE_BASE)
|
||||
except errors.NotFound:
|
||||
entry = self.admin_conn.make_entry(new_dn)
|
||||
entry.setValues("objectclass", ["nsContainer"])
|
||||
try:
|
||||
name = new_dn[1].attr
|
||||
except Exception, e:
|
||||
self.print_msg('Cannot extract RDN attribute value from "%s": %s' % \
|
||||
(new_dn, e))
|
||||
return
|
||||
entry.setValues("cn", name)
|
||||
entry = self.admin_conn.make_entry(
|
||||
new_dn, objectclass=['nsContainer'], cn=[name])
|
||||
self.admin_conn.addEntry(entry)
|
||||
|
||||
entry = self.admin_conn.make_entry(self.smb_dom_dn)
|
||||
entry.setValues("objectclass", [self.OBJC_DOMAIN, "nsContainer"])
|
||||
entry.setValues("cn", self.domain_name)
|
||||
entry.setValues(self.ATTR_FLAT_NAME, self.netbios_name)
|
||||
entry.setValues(self.ATTR_SID, self.__gen_sid_string())
|
||||
entry.setValues(self.ATTR_GUID, str(uuid.uuid4()))
|
||||
entry = self.admin_conn.make_entry(
|
||||
self.smb_dom_dn,
|
||||
{
|
||||
'objectclass': [self.OBJC_DOMAIN, "nsContainer"],
|
||||
'cn': [self.domain_name],
|
||||
self.ATTR_FLAT_NAME: [self.netbios_name],
|
||||
self.ATTR_SID: [self.__gen_sid_string()],
|
||||
self.ATTR_GUID: [str(uuid.uuid4())],
|
||||
}
|
||||
)
|
||||
#TODO: which MAY attributes do we want to set ?
|
||||
self.admin_conn.addEntry(entry)
|
||||
|
||||
@ -452,10 +455,12 @@ class ADTRUSTInstance(service.Service):
|
||||
current.setValues("member", members + [self.cifs_agent])
|
||||
self.admin_conn.updateEntry(self.smb_dn, entry.toDict(), current.toDict())
|
||||
except errors.NotFound:
|
||||
entry = self.admin_conn.make_entry(self.smb_dn)
|
||||
entry.setValues("objectclass", ["top", "GroupOfNames"])
|
||||
entry.setValues("cn", self.smb_dn['cn'])
|
||||
entry.setValues("member", [self.cifs_agent])
|
||||
entry = self.admin_conn.make_entry(
|
||||
self.smb_dn,
|
||||
objectclass=["top", "GroupOfNames"],
|
||||
cn=[self.smb_dn['cn']],
|
||||
member=[self.cifs_agent],
|
||||
)
|
||||
self.admin_conn.addEntry(entry)
|
||||
except Exception, e:
|
||||
# CIFS principal already exists, it is not the first time adtrustinstance is managed
|
||||
@ -734,13 +739,15 @@ class ADTRUSTInstance(service.Service):
|
||||
"range.\nAdd local ID range manually and try " \
|
||||
"again!")
|
||||
|
||||
entry = self.admin_conn.make_entry(DN(('cn', ('%s_id_range' % self.realm)),
|
||||
api.env.container_ranges,
|
||||
self.suffix))
|
||||
entry.setValue('objectclass', 'ipaDomainIDRange')
|
||||
entry.setValue('cn', ('%s_id_range' % self.realm))
|
||||
entry.setValue('ipaBaseID', str(base_id))
|
||||
entry.setValue('ipaIDRangeSize', str(id_range_size))
|
||||
entry = self.admin_conn.make_entry(
|
||||
DN(
|
||||
('cn', ('%s_id_range' % self.realm)),
|
||||
api.env.container_ranges, self.suffix),
|
||||
objectclass=['ipaDomainIDRange'],
|
||||
cn=['%s_id_range' % self.realm],
|
||||
ipaBaseID=[str(base_id)],
|
||||
ipaIDRangeSize=[str(id_range_size)],
|
||||
)
|
||||
self.admin_conn.addEntry(entry)
|
||||
|
||||
def create_instance(self):
|
||||
|
@ -395,14 +395,14 @@ class CADSInstance(service.Service):
|
||||
(ldap.MOD_ADD, "nsslapd-secureport", str(DEFAULT_DSPORT+1))]
|
||||
conn.modify_s(DN(('cn', 'config')), mod)
|
||||
|
||||
entry = conn.make_entry(DN(('cn', 'RSA'), ('cn', 'encryption'), ('cn', 'config')))
|
||||
|
||||
entry.setValues("objectclass", "top", "nsEncryptionModule")
|
||||
entry.setValues("cn", "RSA")
|
||||
entry.setValues("nsSSLPersonalitySSL", self.nickname)
|
||||
entry.setValues("nsSSLToken", "internal (software)")
|
||||
entry.setValues("nsSSLActivation", "on")
|
||||
|
||||
entry = conn.make_entry(
|
||||
DN(('cn', 'RSA'), ('cn', 'encryption'), ('cn', 'config')),
|
||||
objectclass=["top", "nsEncryptionModule"],
|
||||
cn=["RSA"],
|
||||
nsSSLPersonalitySSL=[self.nickname],
|
||||
nsSSLToken=["internal (software)"],
|
||||
nsSSLActivation=["on"],
|
||||
)
|
||||
conn.addEntry(entry)
|
||||
|
||||
conn.unbind()
|
||||
|
@ -570,14 +570,14 @@ class DsInstance(service.Service):
|
||||
mod = [(ldap.MOD_ADD, "nsslapd-security", "on")]
|
||||
conn.modify_s(DN(('cn', 'config')), mod)
|
||||
|
||||
entry = conn.make_entry(DN(('cn', 'RSA'), ('cn', 'encryption'), ('cn', 'config')))
|
||||
|
||||
entry.setValues("objectclass", "top", "nsEncryptionModule")
|
||||
entry.setValues("cn", "RSA")
|
||||
entry.setValues("nsSSLPersonalitySSL", nickname)
|
||||
entry.setValues("nsSSLToken", "internal (software)")
|
||||
entry.setValues("nsSSLActivation", "on")
|
||||
|
||||
entry = conn.make_entry(
|
||||
DN(('cn', 'RSA'), ('cn', 'encryption'), ('cn', 'config')),
|
||||
objectclass=["top", "nsEncryptionModule"],
|
||||
cn=["RSA"],
|
||||
nsSSLPersonalitySSL=[nickname],
|
||||
nsSSLToken=["internal (software)"],
|
||||
nsSSLActivation=["on"],
|
||||
)
|
||||
conn.addEntry(entry)
|
||||
|
||||
conn.unbind()
|
||||
|
@ -108,22 +108,31 @@ class KrbInstance(service.Service):
|
||||
self.admin_conn.deleteEntry(service_dn)
|
||||
|
||||
# Create a host entry for this master
|
||||
host_dn = DN(('fqdn', self.fqdn), ('cn', 'computers'), ('cn', 'accounts'), self.suffix)
|
||||
host_entry = self.admin_conn.make_entry(host_dn)
|
||||
host_entry.setValues('objectclass', ['top', 'ipaobject', 'nshost', 'ipahost', 'ipaservice', 'pkiuser', 'krbprincipalaux', 'krbprincipal', 'krbticketpolicyaux', 'ipasshhost'])
|
||||
host_entry.setValues('krbextradata', service_entry.getValues('krbextradata'))
|
||||
host_entry.setValue('krblastpwdchange', service_entry.getValue('krblastpwdchange'))
|
||||
host_dn = DN(
|
||||
('fqdn', self.fqdn), ('cn', 'computers'), ('cn', 'accounts'),
|
||||
self.suffix)
|
||||
host_entry = self.admin_conn.make_entry(
|
||||
host_dn,
|
||||
objectclass=[
|
||||
'top', 'ipaobject', 'nshost', 'ipahost', 'ipaservice',
|
||||
'pkiuser', 'krbprincipalaux', 'krbprincipal',
|
||||
'krbticketpolicyaux', 'ipasshhost'],
|
||||
krbextradata=service_entry['krbextradata'],
|
||||
krblastpwdchange=service_entry['krblastpwdchange'],
|
||||
krbprincipalname=service_entry['krbprincipalname'],
|
||||
krbprincipalkey=service_entry['krbprincipalkey'],
|
||||
serverhostname=[self.fqdn.split('.',1)[0]],
|
||||
cn=[self.fqdn],
|
||||
fqdn=[self.fqdn],
|
||||
ipauniqueid=['autogenerate'],
|
||||
managedby=[host_dn],
|
||||
)
|
||||
if 'krbpasswordexpiration' in service_entry.toDict():
|
||||
host_entry.setValue('krbpasswordexpiration', service_entry.getValue('krbpasswordexpiration'))
|
||||
host_entry.setValue('krbprincipalname', service_entry.getValue('krbprincipalname'))
|
||||
host_entry['krbpasswordexpiration'] = [
|
||||
service_entry.getValue('krbpasswordexpiration')]
|
||||
if 'krbticketflags' in service_entry.toDict():
|
||||
host_entry.setValue('krbticketflags', service_entry.getValue('krbticketflags'))
|
||||
host_entry.setValue('krbprincipalkey', service_entry.getValue('krbprincipalkey'))
|
||||
host_entry.setValue('serverhostname', self.fqdn.split('.',1)[0])
|
||||
host_entry.setValue('cn', self.fqdn)
|
||||
host_entry.setValue('fqdn', self.fqdn)
|
||||
host_entry.setValue('ipauniqueid', 'autogenerate')
|
||||
host_entry.setValue('managedby', host_dn)
|
||||
host_entry['krbticketflags'] = [
|
||||
service_entry.getValue('krbticketflags')]
|
||||
self.admin_conn.addEntry(host_entry)
|
||||
|
||||
def __common_setup(self, realm_name, host_name, domain_name, admin_password):
|
||||
@ -264,31 +273,30 @@ class KrbInstance(service.Service):
|
||||
root_logger.critical("Error while enumerating SASL mappings %s" % str(e))
|
||||
raise e
|
||||
|
||||
entry = self.admin_conn.make_entry(DN(('cn', 'Full Principal'), ('cn', 'mapping'), ('cn', 'sasl'), ('cn', 'config')))
|
||||
entry.setValues("objectclass", "top", "nsSaslMapping")
|
||||
entry.setValues("cn", "Full Principal")
|
||||
entry.setValues("nsSaslMapRegexString", '\(.*\)@\(.*\)')
|
||||
entry.setValues("nsSaslMapBaseDNTemplate", self.suffix)
|
||||
entry.setValues("nsSaslMapFilterTemplate", '(krbPrincipalName=\\1@\\2)')
|
||||
entry = self.admin_conn.make_entry(
|
||||
DN(
|
||||
('cn', 'Full Principal'), ('cn', 'mapping'), ('cn', 'sasl'),
|
||||
('cn', 'config')),
|
||||
objectclass=["top", "nsSaslMapping"],
|
||||
cn=["Full Principal"],
|
||||
nsSaslMapRegexString=['\(.*\)@\(.*\)'],
|
||||
nsSaslMapBaseDNTemplate=[self.suffix],
|
||||
nsSaslMapFilterTemplate=['(krbPrincipalName=\\1@\\2)'],
|
||||
)
|
||||
self.admin_conn.addEntry(entry)
|
||||
|
||||
try:
|
||||
self.admin_conn.addEntry(entry)
|
||||
except ldap.ALREADY_EXISTS:
|
||||
root_logger.critical("failed to add Full Principal Sasl mapping")
|
||||
raise e
|
||||
|
||||
entry = self.admin_conn.make_entry(DN(('cn', 'Name Only'), ('cn', 'mapping'), ('cn', 'sasl'), ('cn', 'config')))
|
||||
entry.setValues("objectclass", "top", "nsSaslMapping")
|
||||
entry.setValues("cn", "Name Only")
|
||||
entry.setValues("nsSaslMapRegexString", '^[^:@]+$')
|
||||
entry.setValues("nsSaslMapBaseDNTemplate", self.suffix)
|
||||
entry.setValues("nsSaslMapFilterTemplate", '(krbPrincipalName=&@%s)' % self.realm)
|
||||
|
||||
try:
|
||||
self.admin_conn.addEntry(entry)
|
||||
except ldap.ALREADY_EXISTS:
|
||||
root_logger.critical("failed to add Name Only Sasl mapping")
|
||||
raise e
|
||||
entry = self.admin_conn.make_entry(
|
||||
DN(
|
||||
('cn', 'Name Only'), ('cn', 'mapping'), ('cn', 'sasl'),
|
||||
('cn', 'config')),
|
||||
objectclass=["top", "nsSaslMapping"],
|
||||
cn=["Name Only"],
|
||||
nsSaslMapRegexString=['^[^:@]+$'],
|
||||
nsSaslMapBaseDNTemplate=[self.suffix],
|
||||
nsSaslMapFilterTemplate=[
|
||||
'(krbPrincipalName=&@%s)' % self.realm],
|
||||
)
|
||||
self.admin_conn.addEntry(entry)
|
||||
|
||||
def __add_krb_container(self):
|
||||
self._ldap_mod("kerberos.ldif", self.sub_dict)
|
||||
|
@ -422,12 +422,13 @@ class LDAPUpdate:
|
||||
cn = "indextask_%s_%s_%s" % (attribute, cn_uuid.time, cn_uuid.clock_seq)
|
||||
dn = DN(('cn', cn), ('cn', 'index'), ('cn', 'tasks'), ('cn', 'config'))
|
||||
|
||||
e = self.conn.make_entry(dn)
|
||||
|
||||
e.setValues('objectClass', ['top', 'extensibleObject'])
|
||||
e.setValue('cn', cn)
|
||||
e.setValue('nsInstance', 'userRoot')
|
||||
e.setValues('nsIndexAttribute', attribute)
|
||||
e = self.conn.make_entry(
|
||||
dn,
|
||||
objectClass=['top', 'extensibleObject'],
|
||||
cn=[cn],
|
||||
nsInstance=['userRoot'],
|
||||
nsIndexAttribute=[attribute],
|
||||
)
|
||||
|
||||
self.info("Creating task to index attribute: %s", attribute)
|
||||
self.debug("Task id: %s", dn)
|
||||
|
@ -287,11 +287,15 @@ class ReplicationManager(object):
|
||||
rdn_attr = dn[0].attr
|
||||
rdn_val = dn[0].value
|
||||
|
||||
ent = conn.make_entry(dn)
|
||||
ent.setValues("objectclass", "top", "person")
|
||||
ent.setValues(rdn_attr, rdn_val)
|
||||
ent.setValues("userpassword", pw)
|
||||
ent.setValues("sn", "replication manager pseudo user")
|
||||
ent = conn.make_entry(
|
||||
dn,
|
||||
{
|
||||
'objectclass': ["top", "person"],
|
||||
rdn_attr: [rdn_val],
|
||||
'userpassword': [pw],
|
||||
'sn': ["replication manager pseudo user"],
|
||||
}
|
||||
)
|
||||
|
||||
try:
|
||||
conn.addEntry(ent)
|
||||
@ -337,25 +341,28 @@ class ReplicationManager(object):
|
||||
|
||||
replica_type = self.get_replica_type()
|
||||
|
||||
entry = conn.make_entry(dn)
|
||||
entry.setValues('objectclass', "top", "nsds5replica", "extensibleobject")
|
||||
entry.setValues('cn', "replica")
|
||||
entry.setValues('nsds5replicaroot', str(self.suffix))
|
||||
entry.setValues('nsds5replicaid', str(replica_id))
|
||||
entry.setValues('nsds5replicatype', replica_type)
|
||||
entry.setValues('nsds5flags', "1")
|
||||
entry.setValues('nsds5replicabinddn', [replica_binddn])
|
||||
entry.setValues('nsds5replicalegacyconsumer', "off")
|
||||
|
||||
entry = conn.make_entry(
|
||||
dn,
|
||||
objectclass=["top", "nsds5replica", "extensibleobject"],
|
||||
cn=["replica"],
|
||||
nsds5replicaroot=[str(self.suffix)],
|
||||
nsds5replicaid=[str(replica_id)],
|
||||
nsds5replicatype=[replica_type],
|
||||
nsds5flags=["1"],
|
||||
nsds5replicabinddn=[replica_binddn],
|
||||
nsds5replicalegacyconsumer=["off"],
|
||||
)
|
||||
conn.addEntry(entry)
|
||||
|
||||
def setup_changelog(self, conn):
|
||||
dn = DN(('cn', 'changelog5'), ('cn', 'config'))
|
||||
dirpath = conn.dbdir + "/cldb"
|
||||
entry = conn.make_entry(dn)
|
||||
entry.setValues('objectclass', "top", "extensibleobject")
|
||||
entry.setValues('cn', "changelog5")
|
||||
entry.setValues('nsslapd-changelogdir', dirpath)
|
||||
entry = conn.make_entry(
|
||||
DN(('cn', 'changelog5'), ('cn', 'config')),
|
||||
{
|
||||
'objectclass': ["top", "extensibleobject"],
|
||||
'cn': ["changelog5"],
|
||||
'nsslapd-changelogdir': [conn.dbdir + "/cldb"],
|
||||
}
|
||||
)
|
||||
try:
|
||||
conn.addEntry(entry)
|
||||
except errors.DuplicateEntry:
|
||||
@ -372,14 +379,18 @@ class ReplicationManager(object):
|
||||
try:
|
||||
cn = benamebase + str(benum) # e.g. localdb1
|
||||
dn = DN(('cn', cn), chaindn)
|
||||
entry = self.conn.make_entry(dn)
|
||||
entry.setValues('objectclass', 'top', 'extensibleObject', 'nsBackendInstance')
|
||||
entry.setValues('cn', cn)
|
||||
entry.setValues('nsslapd-suffix', str(self.suffix))
|
||||
entry.setValues('nsfarmserverurl', urls)
|
||||
entry.setValues('nsmultiplexorbinddn', self.repl_man_dn)
|
||||
entry.setValues('nsmultiplexorcredentials', self.repl_man_passwd)
|
||||
|
||||
entry = conn.make_entry(
|
||||
dn,
|
||||
{
|
||||
'objectclass': [
|
||||
'top', 'extensibleObject', 'nsBackendInstance'],
|
||||
'cn': [cn],
|
||||
'nsslapd-suffix': [str(self.suffix)],
|
||||
'nsfarmserverurl': urls,
|
||||
'nsmultiplexorbinddn': [self.repl_man_dn],
|
||||
'nsmultiplexorcredentials': [self.repl_man_passwd],
|
||||
}
|
||||
)
|
||||
self.conn.addEntry(entry)
|
||||
done = True
|
||||
except errors.DuplicateEntry:
|
||||
@ -444,10 +455,12 @@ class ReplicationManager(object):
|
||||
pass
|
||||
|
||||
# The user doesn't exist, add it
|
||||
entry = conn.make_entry(pass_dn)
|
||||
entry.setValues("objectclass", ["account", "simplesecurityobject"])
|
||||
entry.setValues("uid", "passsync")
|
||||
entry.setValues("userPassword", password)
|
||||
entry = conn.make_entry(
|
||||
pass_dn,
|
||||
objectclass=["account", "simplesecurityobject"],
|
||||
uid=["passsync"],
|
||||
userPassword=[password],
|
||||
)
|
||||
conn.addEntry(entry)
|
||||
|
||||
# Add it to the list of users allowed to bypass password policy
|
||||
@ -516,25 +529,27 @@ class ReplicationManager(object):
|
||||
except errors.NotFound:
|
||||
pass
|
||||
|
||||
entry = a_conn.make_entry(dn)
|
||||
entry.setValues('objectclass', "nsds5replicationagreement")
|
||||
entry.setValues('cn', cn)
|
||||
entry.setValues('nsds5replicahost', b_hostname)
|
||||
entry.setValues('nsds5replicaport', str(port))
|
||||
entry.setValues('nsds5replicatimeout', str(TIMEOUT))
|
||||
entry.setValues('nsds5replicaroot', str(self.suffix))
|
||||
entry = a_conn.make_entry(
|
||||
dn,
|
||||
objectclass=["nsds5replicationagreement"],
|
||||
cn=[cn],
|
||||
nsds5replicahost=[b_hostname],
|
||||
nsds5replicaport=[str(port)],
|
||||
nsds5replicatimeout=[str(TIMEOUT)],
|
||||
nsds5replicaroot=[str(self.suffix)],
|
||||
description=["me to %s" % b_hostname],
|
||||
)
|
||||
if master is None:
|
||||
entry.setValues('nsDS5ReplicatedAttributeList',
|
||||
'(objectclass=*) $ EXCLUDE %s' % " ".join(EXCLUDES))
|
||||
entry.setValues('description', "me to %s" % b_hostname)
|
||||
entry['nsDS5ReplicatedAttributeList'] = [
|
||||
'(objectclass=*) $ EXCLUDE %s' % " ".join(EXCLUDES)]
|
||||
if isgssapi:
|
||||
entry.setValues('nsds5replicatransportinfo', 'LDAP')
|
||||
entry.setValues('nsds5replicabindmethod', 'SASL/GSSAPI')
|
||||
entry['nsds5replicatransportinfo'] = ['LDAP']
|
||||
entry['nsds5replicabindmethod'] = ['SASL/GSSAPI']
|
||||
else:
|
||||
entry.setValues('nsds5replicabinddn', repl_man_dn)
|
||||
entry.setValues('nsds5replicacredentials', repl_man_passwd)
|
||||
entry.setValues('nsds5replicatransportinfo', 'TLS')
|
||||
entry.setValues('nsds5replicabindmethod', 'simple')
|
||||
entry['nsds5replicabinddn'] = [repl_man_dn]
|
||||
entry['nsds5replicacredentials'] = [repl_man_passwd]
|
||||
entry['nsds5replicatransportinfo'] = ['TLS']
|
||||
entry['nsds5replicabindmethod'] = ['simple']
|
||||
|
||||
if iswinsync:
|
||||
self.setup_winsync_agmt(entry, win_subtree)
|
||||
@ -551,7 +566,7 @@ class ReplicationManager(object):
|
||||
# that we will have to set the memberof fixup task
|
||||
self.need_memberof_fixup = True
|
||||
|
||||
entry.setValues('nsds5ReplicaStripAttrs', " ".join(STRIP_ATTRS))
|
||||
entry['nsds5ReplicaStripAttrs'] = [" ".join(STRIP_ATTRS)]
|
||||
|
||||
entry = a_conn.waitForEntry(entry)
|
||||
|
||||
@ -912,10 +927,12 @@ class ReplicationManager(object):
|
||||
|
||||
# Add winsync replica to the public DIT
|
||||
dn = DN(('cn',ad_dc_name),('cn','replicas'),('cn','ipa'),('cn','etc'), self.suffix)
|
||||
entry = self.conn.make_entry(dn)
|
||||
entry.setValues("objectclass", ["nsContainer", "ipaConfigObject"])
|
||||
entry.setValues("cn", ad_dc_name)
|
||||
entry.setValues("ipaConfigString", "winsync:%s" % self.hostname)
|
||||
entry = self.conn.make_entry(
|
||||
dn,
|
||||
objectclass=["nsContainer", "ipaConfigObject"],
|
||||
cn=[ad_dc_name],
|
||||
ipaConfigString=["winsync:%s" % self.hostname],
|
||||
)
|
||||
|
||||
try:
|
||||
self.conn.addEntry(entry)
|
||||
@ -1167,11 +1184,15 @@ class ReplicationManager(object):
|
||||
root_logger.debug("Creating CLEANALLRUV task for replica id %d" % replicaId)
|
||||
|
||||
dn = DN(('cn', 'clean %d' % replicaId), ('cn', 'cleanallruv'),('cn', 'tasks'), ('cn', 'config'))
|
||||
e = self.conn.make_entry(dn)
|
||||
e.setValues('objectclass', ['top', 'extensibleObject'])
|
||||
e.setValue('replica-base-dn', api.env.basedn)
|
||||
e.setValue('replica-id', replicaId)
|
||||
e.setValue('cn', 'clean %d' % replicaId)
|
||||
e = self.conn.make_entry(
|
||||
dn,
|
||||
{
|
||||
'objectclass': ['top', 'extensibleObject'],
|
||||
'cn': ['clean %d' % replicaId],
|
||||
'replica-base-dn': [api.env.basedn],
|
||||
'replica-id': [replicaId],
|
||||
}
|
||||
)
|
||||
try:
|
||||
self.conn.addEntry(e)
|
||||
except errors.DuplicateEntry:
|
||||
@ -1190,11 +1211,15 @@ class ReplicationManager(object):
|
||||
root_logger.debug("Creating task to abort a CLEANALLRUV operation for replica id %d" % replicaId)
|
||||
|
||||
dn = DN(('cn', 'abort %d' % replicaId), ('cn', 'abort cleanallruv'),('cn', 'tasks'), ('cn', 'config'))
|
||||
e = self.conn.make_entry(dn)
|
||||
e.setValues('objectclass', ['top', 'extensibleObject'])
|
||||
e.setValue('replica-base-dn', api.env.basedn)
|
||||
e.setValue('replica-id', replicaId)
|
||||
e.setValue('cn', 'abort %d' % replicaId)
|
||||
e = self.conn.make_entry(
|
||||
dn,
|
||||
{
|
||||
'replica-base-dn': [api.env.basedn],
|
||||
'replica-id': [replicaId],
|
||||
'objectclass': ['top', 'extensibleObject'],
|
||||
'cn': ['abort %d' % replicaId],
|
||||
}
|
||||
)
|
||||
try:
|
||||
self.conn.addEntry(e)
|
||||
except errors.DuplicateEntry:
|
||||
|
@ -120,7 +120,7 @@ class Service(object):
|
||||
conn.do_sasl_gssapi_bind()
|
||||
except Exception, e:
|
||||
root_logger.debug("Could not connect to the Directory Server on %s: %s" % (self.fqdn, str(e)))
|
||||
raise e
|
||||
raise
|
||||
|
||||
self.admin_conn = conn
|
||||
|
||||
@ -216,11 +216,15 @@ class Service(object):
|
||||
|
||||
dn = DN(('krbprincipalname', principal), ('cn', 'services'), ('cn', 'accounts'), self.suffix)
|
||||
hostdn = DN(('fqdn', self.fqdn), ('cn', 'computers'), ('cn', 'accounts'), self.suffix)
|
||||
entry = self.admin_conn.make_entry(dn)
|
||||
entry.setValues("objectclass", ["krbprincipal", "krbprincipalaux", "krbticketpolicyaux", "ipaobject", "ipaservice", "pkiuser"])
|
||||
entry.setValue("krbprincipalname", principal)
|
||||
entry.setValue("ipauniqueid", 'autogenerate')
|
||||
entry.setValue("managedby", hostdn)
|
||||
entry = self.admin_conn.make_entry(
|
||||
dn,
|
||||
objectclass=[
|
||||
"krbprincipal", "krbprincipalaux", "krbticketpolicyaux",
|
||||
"ipaobject", "ipaservice", "pkiuser"],
|
||||
krbprincipalname=[principal],
|
||||
ipauniqueid=['autogenerate'],
|
||||
managedby=[hostdn],
|
||||
)
|
||||
self.admin_conn.addEntry(entry)
|
||||
return dn
|
||||
|
||||
@ -373,12 +377,13 @@ class Service(object):
|
||||
|
||||
entry_name = DN(('cn', name), ('cn', fqdn), ('cn', 'masters'), ('cn', 'ipa'), ('cn', 'etc'), ldap_suffix)
|
||||
order = SERVICE_LIST[name][1]
|
||||
entry = self.admin_conn.make_entry(entry_name)
|
||||
entry.setValues("objectclass",
|
||||
"nsContainer", "ipaConfigObject")
|
||||
entry.setValues("cn", name)
|
||||
entry.setValues("ipaconfigstring",
|
||||
"enabledService", "startOrder " + str(order))
|
||||
entry = self.admin_conn.make_entry(
|
||||
entry_name,
|
||||
objectclass=["nsContainer", "ipaConfigObject"],
|
||||
cn=[name],
|
||||
ipaconfigstring=[
|
||||
"enabledService", "startOrder " + str(order)],
|
||||
)
|
||||
|
||||
try:
|
||||
self.admin_conn.addEntry(entry)
|
||||
|
Loading…
Reference in New Issue
Block a user