diff options
author | Jan Cholasta <jcholast@redhat.com> | 2013-01-22 09:58:53 +0100 |
---|---|---|
committer | Martin Kosek <mkosek@redhat.com> | 2013-03-01 16:59:43 +0100 |
commit | c1d6937ea274256e8a4422e3415670567f07dd4e (patch) | |
tree | ccfeb88848e77d19b5c8b0ad810e0fcb6378f77e /ipaserver/install/ldapupdate.py | |
parent | 8d92ca851c6a0d3380ddbe13c3b442adab274f93 (diff) | |
download | freeipa-c1d6937ea274256e8a4422e3415670567f07dd4e.tar.gz freeipa-c1d6937ea274256e8a4422e3415670567f07dd4e.tar.xz freeipa-c1d6937ea274256e8a4422e3415670567f07dd4e.zip |
Remove the Entity class.
Move Entity functionality to LDAPEntry.
Diffstat (limited to 'ipaserver/install/ldapupdate.py')
-rw-r--r-- | ipaserver/install/ldapupdate.py | 35 |
1 files changed, 4 insertions, 31 deletions
diff --git a/ipaserver/install/ldapupdate.py b/ipaserver/install/ldapupdate.py index d2a23e55e..a35df371a 100644 --- a/ipaserver/install/ldapupdate.py +++ b/ipaserver/install/ldapupdate.py @@ -33,7 +33,6 @@ import pwd import fnmatch import csv import inspect -import copy import krbV import ldap @@ -49,29 +48,6 @@ from ipapython.ipa_log_manager import * from ipaserver.install.plugins import PRE_UPDATE, POST_UPDATE -class Entity(ipaldap.Entry): - # TODO: Use ldap2 instead - def __init__(self, entrydata=None): - ipaldap.Entry.__init__(self, entrydata) - y = {} - for key, value in self.data.iteritems(): - y[copy.deepcopy(key)] = copy.deepcopy(value) - self.orig_data = ipautil.CIDict(y) - - def attrList(self): - """Return a list of all attributes in the entry""" - return self.data.keys() - - def origDataDict(self): - """Returns a dict of the original values of the user. - - Used for updates. - """ - result = ipautil.CIDict(self.orig_data) - result['dn'] = self.dn - return result - - class BadSyntax(installutils.ScriptError): def __init__(self, value): self.value = value @@ -269,18 +245,15 @@ class LDAPUpdate: return text def _entry_to_entity(self, ent): - """Tne Entry class is a bare LDAP entry. The Entity class has a lot more - helper functions that we need, so convert to dict and then to Entity. - """ - entry = dict(ent.data) - entry['dn'] = ent.dn + entry = ent.copy() for key,value in entry.iteritems(): if isinstance(value,list) or isinstance(value,tuple): if len(value) == 0: entry[key] = '' elif len(value) == 1: entry[key] = value[0] - return Entity(entry) + entry.commit() + return entry def _combine_updates(self, all_updates, update): 'Combine a new update with the list of total updates' @@ -508,7 +481,7 @@ class LDAPUpdate: def _create_default_entry(self, dn, default): """Create the default entry from the values provided. - The return type is Entity + The return type is ipaldap.Entry """ assert isinstance(dn, DN) entry = self.conn.make_entry(dn) |