Replace add_s and delete_s by their newer equivalents

Part of the work for: https://fedorahosted.org/freeipa/ticket/2660
This commit is contained in:
Petr Viktorin 2013-01-21 04:56:50 -05:00 committed by Martin Kosek
parent 66c7fd1323
commit aa6fb75637
3 changed files with 15 additions and 15 deletions

View File

@ -1080,7 +1080,7 @@ class CAInstance(service.Service):
DN(('CN', 'IPA RA'), self.subject_base))), DN(('CN', 'IPA RA'), self.subject_base))),
] ]
conn.add_s(entry_dn, entry) conn.add_entry(entry_dn, entry)
dn = DN(('cn', 'Certificate Manager Agents'), ('ou', 'groups'), self.basedn) dn = DN(('cn', 'Certificate Manager Agents'), ('ou', 'groups'), self.basedn)
modlist = [(0, 'uniqueMember', '%s' % entry_dn)] modlist = [(0, 'uniqueMember', '%s' % entry_dn)]

View File

@ -38,7 +38,6 @@ from ipaserver.install import replication
from ipaserver.install import dsinstance from ipaserver.install import dsinstance
import ldap import ldap
from ldap import LDAPError
import pyasn1.codec.ber.decoder import pyasn1.codec.ber.decoder
import struct import struct
@ -265,13 +264,14 @@ class KrbInstance(service.Service):
"(objectclass=nsSaslMapping)") "(objectclass=nsSaslMapping)")
for r in res: for r in res:
try: try:
self.admin_conn.delete_s(r.dn) self.admin_conn.delete_entry(r.dn)
except LDAPError, e: except Exception, e:
root_logger.critical("Error during SASL mapping removal: %s" % str(e)) root_logger.critical(
raise e "Error during SASL mapping removal: %s", e)
except LDAPError, e: raise
root_logger.critical("Error while enumerating SASL mappings %s" % str(e)) except Exception, e:
raise e root_logger.critical("Error while enumerating SASL mappings %s", e)
raise
entry = self.admin_conn.make_entry( entry = self.admin_conn.make_entry(
DN( DN(

View File

@ -306,8 +306,8 @@ class ReplicationManager(object):
def delete_replication_manager(self, conn, dn=REPL_MAN_DN): def delete_replication_manager(self, conn, dn=REPL_MAN_DN):
assert isinstance(dn, DN) assert isinstance(dn, DN)
try: try:
conn.delete_s(dn) conn.delete_entry(dn)
except ldap.NO_SUCH_OBJECT: except errors.NotFound:
pass pass
def get_replica_type(self, master=True): def get_replica_type(self, master=True):
@ -680,12 +680,12 @@ class ReplicationManager(object):
# Finally remove the temporary replication manager user # Finally remove the temporary replication manager user
try: try:
a.delete_s(self.repl_man_dn) a.delete_entry(self.repl_man_dn)
except ldap.NO_SUCH_OBJECT: except errors.NotFound:
pass pass
try: try:
b.delete_s(self.repl_man_dn) b.delete_entry(self.repl_man_dn)
except ldap.NO_SUCH_OBJECT: except errors.NotFound:
pass pass
def delete_agreement(self, hostname, dn=None): def delete_agreement(self, hostname, dn=None):