mirror of
https://salsa.debian.org/freeipa-team/freeipa.git
synced 2025-02-25 18:55:28 -06:00
Replace addEntry with add_entry
Part of the work for: https://fedorahosted.org/freeipa/ticket/2660
This commit is contained in:
committed by
Martin Kosek
parent
aaa41b2145
commit
f8ad7cb96f
@@ -333,7 +333,7 @@ class ADTRUSTInstance(service.Service):
|
|||||||
return
|
return
|
||||||
entry = self.admin_conn.make_entry(
|
entry = self.admin_conn.make_entry(
|
||||||
new_dn, objectclass=['nsContainer'], cn=[name])
|
new_dn, objectclass=['nsContainer'], cn=[name])
|
||||||
self.admin_conn.addEntry(entry)
|
self.admin_conn.add_entry(entry)
|
||||||
|
|
||||||
entry = self.admin_conn.make_entry(
|
entry = self.admin_conn.make_entry(
|
||||||
self.smb_dom_dn,
|
self.smb_dom_dn,
|
||||||
@@ -346,7 +346,7 @@ class ADTRUSTInstance(service.Service):
|
|||||||
}
|
}
|
||||||
)
|
)
|
||||||
#TODO: which MAY attributes do we want to set ?
|
#TODO: which MAY attributes do we want to set ?
|
||||||
self.admin_conn.addEntry(entry)
|
self.admin_conn.add_entry(entry)
|
||||||
|
|
||||||
def __write_smb_conf(self):
|
def __write_smb_conf(self):
|
||||||
self.fstore.backup_file(self.smb_conf)
|
self.fstore.backup_file(self.smb_conf)
|
||||||
@@ -458,7 +458,7 @@ class ADTRUSTInstance(service.Service):
|
|||||||
cn=[self.smb_dn['cn']],
|
cn=[self.smb_dn['cn']],
|
||||||
member=[self.cifs_agent],
|
member=[self.cifs_agent],
|
||||||
)
|
)
|
||||||
self.admin_conn.addEntry(entry)
|
self.admin_conn.add_entry(entry)
|
||||||
except Exception, e:
|
except Exception, e:
|
||||||
# CIFS principal already exists, it is not the first time adtrustinstance is managed
|
# CIFS principal already exists, it is not the first time adtrustinstance is managed
|
||||||
# That's fine, we we'll re-extract the key again.
|
# That's fine, we we'll re-extract the key again.
|
||||||
@@ -745,7 +745,7 @@ class ADTRUSTInstance(service.Service):
|
|||||||
ipaBaseID=[str(base_id)],
|
ipaBaseID=[str(base_id)],
|
||||||
ipaIDRangeSize=[str(id_range_size)],
|
ipaIDRangeSize=[str(id_range_size)],
|
||||||
)
|
)
|
||||||
self.admin_conn.addEntry(entry)
|
self.admin_conn.add_entry(entry)
|
||||||
|
|
||||||
def create_instance(self):
|
def create_instance(self):
|
||||||
|
|
||||||
|
|||||||
@@ -397,7 +397,7 @@ class CADSInstance(service.Service):
|
|||||||
nsSSLToken=["internal (software)"],
|
nsSSLToken=["internal (software)"],
|
||||||
nsSSLActivation=["on"],
|
nsSSLActivation=["on"],
|
||||||
)
|
)
|
||||||
conn.addEntry(entry)
|
conn.add_entry(entry)
|
||||||
|
|
||||||
conn.unbind()
|
conn.unbind()
|
||||||
|
|
||||||
|
|||||||
@@ -578,7 +578,7 @@ class DsInstance(service.Service):
|
|||||||
nsSSLToken=["internal (software)"],
|
nsSSLToken=["internal (software)"],
|
||||||
nsSSLActivation=["on"],
|
nsSSLActivation=["on"],
|
||||||
)
|
)
|
||||||
conn.addEntry(entry)
|
conn.add_entry(entry)
|
||||||
|
|
||||||
conn.unbind()
|
conn.unbind()
|
||||||
|
|
||||||
|
|||||||
@@ -131,7 +131,7 @@ class KrbInstance(service.Service):
|
|||||||
'krbpasswordexpiration']
|
'krbpasswordexpiration']
|
||||||
if 'krbticketflags' in service_entry.toDict():
|
if 'krbticketflags' in service_entry.toDict():
|
||||||
host_entry['krbticketflags'] = service_entry['krbticketflags']
|
host_entry['krbticketflags'] = service_entry['krbticketflags']
|
||||||
self.admin_conn.addEntry(host_entry)
|
self.admin_conn.add_entry(host_entry)
|
||||||
|
|
||||||
def __common_setup(self, realm_name, host_name, domain_name, admin_password):
|
def __common_setup(self, realm_name, host_name, domain_name, admin_password):
|
||||||
self.fqdn = host_name
|
self.fqdn = host_name
|
||||||
@@ -282,7 +282,7 @@ class KrbInstance(service.Service):
|
|||||||
nsSaslMapBaseDNTemplate=[self.suffix],
|
nsSaslMapBaseDNTemplate=[self.suffix],
|
||||||
nsSaslMapFilterTemplate=['(krbPrincipalName=\\1@\\2)'],
|
nsSaslMapFilterTemplate=['(krbPrincipalName=\\1@\\2)'],
|
||||||
)
|
)
|
||||||
self.admin_conn.addEntry(entry)
|
self.admin_conn.add_entry(entry)
|
||||||
|
|
||||||
entry = self.admin_conn.make_entry(
|
entry = self.admin_conn.make_entry(
|
||||||
DN(
|
DN(
|
||||||
@@ -295,7 +295,7 @@ class KrbInstance(service.Service):
|
|||||||
nsSaslMapFilterTemplate=[
|
nsSaslMapFilterTemplate=[
|
||||||
'(krbPrincipalName=&@%s)' % self.realm],
|
'(krbPrincipalName=&@%s)' % self.realm],
|
||||||
)
|
)
|
||||||
self.admin_conn.addEntry(entry)
|
self.admin_conn.add_entry(entry)
|
||||||
|
|
||||||
def __add_krb_container(self):
|
def __add_krb_container(self):
|
||||||
self._ldap_mod("kerberos.ldif", self.sub_dict)
|
self._ldap_mod("kerberos.ldif", self.sub_dict)
|
||||||
|
|||||||
@@ -428,7 +428,7 @@ class LDAPUpdate:
|
|||||||
self.debug("Task id: %s", dn)
|
self.debug("Task id: %s", dn)
|
||||||
|
|
||||||
if self.live_run:
|
if self.live_run:
|
||||||
self.conn.addEntry(e)
|
self.conn.add_entry(e)
|
||||||
|
|
||||||
return dn
|
return dn
|
||||||
|
|
||||||
@@ -769,7 +769,7 @@ class LDAPUpdate:
|
|||||||
# dn defined. In that case there is nothing to do.
|
# dn defined. In that case there is nothing to do.
|
||||||
# It means the entry doesn't exist, so skip it.
|
# It means the entry doesn't exist, so skip it.
|
||||||
try:
|
try:
|
||||||
self.conn.addEntry(entry)
|
self.conn.add_entry(entry)
|
||||||
except errors.NotFound:
|
except errors.NotFound:
|
||||||
# parent entry of the added entry does not exist
|
# parent entry of the added entry does not exist
|
||||||
# this may not be an error (e.g. entries in NIS container)
|
# this may not be an error (e.g. entries in NIS container)
|
||||||
|
|||||||
@@ -323,7 +323,7 @@ class ReplicationManager(object):
|
|||||||
)
|
)
|
||||||
|
|
||||||
try:
|
try:
|
||||||
conn.addEntry(ent)
|
conn.add_entry(ent)
|
||||||
except errors.DuplicateEntry:
|
except errors.DuplicateEntry:
|
||||||
conn.modify_s(dn, [(ldap.MOD_REPLACE, "userpassword", pw)])
|
conn.modify_s(dn, [(ldap.MOD_REPLACE, "userpassword", pw)])
|
||||||
pass
|
pass
|
||||||
@@ -377,7 +377,7 @@ class ReplicationManager(object):
|
|||||||
nsds5replicabinddn=[replica_binddn],
|
nsds5replicabinddn=[replica_binddn],
|
||||||
nsds5replicalegacyconsumer=["off"],
|
nsds5replicalegacyconsumer=["off"],
|
||||||
)
|
)
|
||||||
conn.addEntry(entry)
|
conn.add_entry(entry)
|
||||||
|
|
||||||
def setup_changelog(self, conn):
|
def setup_changelog(self, conn):
|
||||||
ent = conn.get_entry(
|
ent = conn.get_entry(
|
||||||
@@ -396,7 +396,7 @@ class ReplicationManager(object):
|
|||||||
}
|
}
|
||||||
)
|
)
|
||||||
try:
|
try:
|
||||||
conn.addEntry(entry)
|
conn.add_entry(entry)
|
||||||
except errors.DuplicateEntry:
|
except errors.DuplicateEntry:
|
||||||
return
|
return
|
||||||
|
|
||||||
@@ -423,7 +423,7 @@ class ReplicationManager(object):
|
|||||||
'nsmultiplexorcredentials': [self.repl_man_passwd],
|
'nsmultiplexorcredentials': [self.repl_man_passwd],
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
self.conn.addEntry(entry)
|
self.conn.add_entry(entry)
|
||||||
done = True
|
done = True
|
||||||
except errors.DuplicateEntry:
|
except errors.DuplicateEntry:
|
||||||
benum += 1
|
benum += 1
|
||||||
@@ -493,7 +493,7 @@ class ReplicationManager(object):
|
|||||||
uid=["passsync"],
|
uid=["passsync"],
|
||||||
userPassword=[password],
|
userPassword=[password],
|
||||||
)
|
)
|
||||||
conn.addEntry(entry)
|
conn.add_entry(entry)
|
||||||
|
|
||||||
# Add it to the list of users allowed to bypass password policy
|
# Add it to the list of users allowed to bypass password policy
|
||||||
extop_dn = DN(('cn', 'ipa_pwd_extop'), ('cn', 'plugins'), ('cn', 'config'))
|
extop_dn = DN(('cn', 'ipa_pwd_extop'), ('cn', 'plugins'), ('cn', 'config'))
|
||||||
@@ -586,7 +586,7 @@ class ReplicationManager(object):
|
|||||||
if iswinsync:
|
if iswinsync:
|
||||||
self.setup_winsync_agmt(entry, win_subtree)
|
self.setup_winsync_agmt(entry, win_subtree)
|
||||||
|
|
||||||
a_conn.addEntry(entry)
|
a_conn.add_entry(entry)
|
||||||
|
|
||||||
try:
|
try:
|
||||||
mod = [(ldap.MOD_ADD, 'nsDS5ReplicatedAttributeListTotal',
|
mod = [(ldap.MOD_ADD, 'nsDS5ReplicatedAttributeListTotal',
|
||||||
@@ -969,7 +969,7 @@ class ReplicationManager(object):
|
|||||||
)
|
)
|
||||||
|
|
||||||
try:
|
try:
|
||||||
self.conn.addEntry(entry)
|
self.conn.add_entry(entry)
|
||||||
except Exception, e:
|
except Exception, e:
|
||||||
root_logger.info("Failed to create public entry for winsync replica")
|
root_logger.info("Failed to create public entry for winsync replica")
|
||||||
|
|
||||||
@@ -1225,7 +1225,7 @@ class ReplicationManager(object):
|
|||||||
}
|
}
|
||||||
)
|
)
|
||||||
try:
|
try:
|
||||||
self.conn.addEntry(e)
|
self.conn.add_entry(e)
|
||||||
except errors.DuplicateEntry:
|
except errors.DuplicateEntry:
|
||||||
print "CLEANALLRUV task for replica id %d already exists." % replicaId
|
print "CLEANALLRUV task for replica id %d already exists." % replicaId
|
||||||
else:
|
else:
|
||||||
@@ -1252,7 +1252,7 @@ class ReplicationManager(object):
|
|||||||
}
|
}
|
||||||
)
|
)
|
||||||
try:
|
try:
|
||||||
self.conn.addEntry(e)
|
self.conn.add_entry(e)
|
||||||
except errors.DuplicateEntry:
|
except errors.DuplicateEntry:
|
||||||
print "An abort CLEANALLRUV task for replica id %d already exists." % replicaId
|
print "An abort CLEANALLRUV task for replica id %d already exists." % replicaId
|
||||||
else:
|
else:
|
||||||
|
|||||||
@@ -202,7 +202,7 @@ class Service(object):
|
|||||||
entry["objectclass"] = list(set(classes))
|
entry["objectclass"] = list(set(classes))
|
||||||
entry["ipauniqueid"] = ['autogenerate']
|
entry["ipauniqueid"] = ['autogenerate']
|
||||||
entry["managedby"] = [hostdn]
|
entry["managedby"] = [hostdn]
|
||||||
self.admin_conn.addEntry(entry)
|
self.admin_conn.add_entry(entry)
|
||||||
return newdn
|
return newdn
|
||||||
|
|
||||||
def add_simple_service(self, principal):
|
def add_simple_service(self, principal):
|
||||||
@@ -225,7 +225,7 @@ class Service(object):
|
|||||||
ipauniqueid=['autogenerate'],
|
ipauniqueid=['autogenerate'],
|
||||||
managedby=[hostdn],
|
managedby=[hostdn],
|
||||||
)
|
)
|
||||||
self.admin_conn.addEntry(entry)
|
self.admin_conn.add_entry(entry)
|
||||||
return dn
|
return dn
|
||||||
|
|
||||||
def add_cert_to_service(self):
|
def add_cert_to_service(self):
|
||||||
@@ -386,7 +386,7 @@ class Service(object):
|
|||||||
)
|
)
|
||||||
|
|
||||||
try:
|
try:
|
||||||
self.admin_conn.addEntry(entry)
|
self.admin_conn.add_entry(entry)
|
||||||
except (ldap.ALREADY_EXISTS, errors.DuplicateEntry), e:
|
except (ldap.ALREADY_EXISTS, errors.DuplicateEntry), e:
|
||||||
root_logger.debug("failed to add %s Service startup entry" % name)
|
root_logger.debug("failed to add %s Service startup entry" % name)
|
||||||
raise e
|
raise e
|
||||||
|
|||||||
@@ -1632,11 +1632,6 @@ class IPAdmin(LDAPClient):
|
|||||||
)
|
)
|
||||||
return result[0]
|
return result[0]
|
||||||
|
|
||||||
def addEntry(self, entry):
|
|
||||||
# FIXME: for backwards compatibility only
|
|
||||||
self.add_entry(entry.dn, entry)
|
|
||||||
return True
|
|
||||||
|
|
||||||
def updateEntry(self,dn,oldentry,newentry):
|
def updateEntry(self,dn,oldentry,newentry):
|
||||||
# FIXME: for backwards compatibility only
|
# FIXME: for backwards compatibility only
|
||||||
"""This wraps the mod function. It assumes that the entry is already
|
"""This wraps the mod function. It assumes that the entry is already
|
||||||
|
|||||||
Reference in New Issue
Block a user