diff options
author | Petr Viktorin <pviktori@redhat.com> | 2013-01-30 09:51:08 -0500 |
---|---|---|
committer | Martin Kosek <mkosek@redhat.com> | 2013-03-01 16:59:46 +0100 |
commit | 982b78277755a301e3baa1d4f2bd7e1663fb88a5 (patch) | |
tree | 1fc9a5c53663f98dd62ec759cc9d16a76ce2fd2b /ipaserver/install/service.py | |
parent | 29a02a3530214d2e72667e98c5ecc25ebf5fad48 (diff) | |
download | freeipa.git-982b78277755a301e3baa1d4f2bd7e1663fb88a5.tar.gz freeipa.git-982b78277755a301e3baa1d4f2bd7e1663fb88a5.tar.xz freeipa.git-982b78277755a301e3baa1d4f2bd7e1663fb88a5.zip |
Remove some uses of raw python-ldap
Part of the work for: https://fedorahosted.org/freeipa/ticket/2660
Diffstat (limited to 'ipaserver/install/service.py')
-rw-r--r-- | ipaserver/install/service.py | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/ipaserver/install/service.py b/ipaserver/install/service.py index cc5bb877..633287e2 100644 --- a/ipaserver/install/service.py +++ b/ipaserver/install/service.py @@ -24,8 +24,6 @@ import pwd import time import datetime -import ldap - from ipapython import sysrestore from ipapython import ipautil from ipapython import dogtag @@ -249,10 +247,12 @@ class Service(object): self.ldap_disconnect() self.ldap_connect() - dn = DN(('krbprincipalname', self.principal), ('cn', 'services'), ('cn', 'accounts'), self.suffix) - mod = [(ldap.MOD_ADD, 'userCertificate', self.dercert)] + dn = DN(('krbprincipalname', self.principal), ('cn', 'services'), + ('cn', 'accounts'), self.suffix) + entry = self.admin_conn.get_entry(dn) + entry.setdefault('userCertificate', []).append(self.dercert) try: - self.admin_conn.modify_s(dn, mod) + self.admin_conn.update_entry(entry) except Exception, e: root_logger.critical("Could not add certificate to service %s entry: %s" % (self.principal, str(e))) @@ -387,7 +387,7 @@ class Service(object): try: self.admin_conn.add_entry(entry) - except (ldap.ALREADY_EXISTS, errors.DuplicateEntry), e: + except (errors.DuplicateEntry), e: root_logger.debug("failed to add %s Service startup entry" % name) raise e |