summaryrefslogtreecommitdiffstats
path: root/ipaserver
diff options
context:
space:
mode:
authorPetr Viktorin <pviktori@redhat.com>2013-01-21 04:34:44 -0500
committerMartin Kosek <mkosek@redhat.com>2013-03-01 16:59:44 +0100
commitc613caab67337293a410c07713c89345d0124f2c (patch)
treefc0712cd0c5bcb367d53897679e4efdc030578b8 /ipaserver
parentb2dd8d7f0512dff47bd5b1b973da50dd56a2e99e (diff)
downloadfreeipa-c613caab67337293a410c07713c89345d0124f2c.tar.gz
freeipa-c613caab67337293a410c07713c89345d0124f2c.tar.xz
freeipa-c613caab67337293a410c07713c89345d0124f2c.zip
Replace entry.getValues() by entry.get()
Part of the work for: https://fedorahosted.org/freeipa/ticket/2660
Diffstat (limited to 'ipaserver')
-rw-r--r--ipaserver/install/ldapupdate.py10
-rw-r--r--ipaserver/install/replication.py6
-rw-r--r--ipaserver/install/service.py2
-rw-r--r--ipaserver/ipaldap.py5
4 files changed, 9 insertions, 14 deletions
diff --git a/ipaserver/install/ldapupdate.py b/ipaserver/install/ldapupdate.py
index 5de43749b..90975d7d7 100644
--- a/ipaserver/install/ldapupdate.py
+++ b/ipaserver/install/ldapupdate.py
@@ -494,7 +494,7 @@ class LDAPUpdate:
for item in default:
# We already do syntax-parsing so this is safe
(attr, value) = item.split(':',1)
- e = entry.getValues(attr)
+ e = entry.get(attr)
if e:
# multi-valued attribute
e = list(e)
@@ -538,7 +538,7 @@ class LDAPUpdate:
if self.conn.has_dn_syntax(attr):
update_values = [DN(x) for x in update_values]
- entry_values = entry.getValues(attr)
+ entry_values = entry.get(attr)
if not isinstance(entry_values, list):
if entry_values is None:
entry_values = []
@@ -607,7 +607,7 @@ class LDAPUpdate:
self.debug("addifexist: '%s' to %s, current value %s", update_value, attr, entry_values)
# Only add the attribute if the entry doesn't exist. We
# determine this based on whether it has an objectclass
- if entry.getValues('objectclass'):
+ if entry.get('objectclass'):
entry_values.append(update_value)
self.debug('addifexist: set %s to %s', attr, entry_values)
entry.setValues(attr, entry_values)
@@ -624,7 +624,7 @@ class LDAPUpdate:
self.debug("onlyifexist: '%s' to %s, current value %s", update_value, attr, entry_values)
# Only set the attribute if the entry exist's. We
# determine this based on whether it has an objectclass
- if entry.getValues('objectclass'):
+ if entry.get('objectclass'):
if only.get(attr):
entry_values.append(update_value)
else:
@@ -681,7 +681,7 @@ class LDAPUpdate:
self.debug("dn: %s", e.dn)
attr = e.attrList()
for a in attr:
- value = e.getValues(a)
+ value = e.get(a)
if isinstance(value, (list, tuple)):
self.debug('%s:', a)
for l in value:
diff --git a/ipaserver/install/replication.py b/ipaserver/install/replication.py
index 52db8c7ab..c017bbdac 100644
--- a/ipaserver/install/replication.py
+++ b/ipaserver/install/replication.py
@@ -326,7 +326,7 @@ class ReplicationManager(object):
try:
entry = conn.getEntry(dn, ldap.SCOPE_BASE)
- managers = entry.getValues('nsDS5ReplicaBindDN')
+ managers = entry.get('nsDS5ReplicaBindDN')
for m in managers:
if replica_binddn == DN(m):
return
@@ -466,7 +466,7 @@ class ReplicationManager(object):
# Add it to the list of users allowed to bypass password policy
extop_dn = DN(('cn', 'ipa_pwd_extop'), ('cn', 'plugins'), ('cn', 'config'))
entry = conn.getEntry(extop_dn, ldap.SCOPE_BASE)
- pass_mgrs = entry.getValues('passSyncManagersDNs')
+ pass_mgrs = entry.get('passSyncManagersDNs')
if not pass_mgrs:
pass_mgrs = []
if not isinstance(pass_mgrs, list):
@@ -1033,7 +1033,7 @@ class ReplicationManager(object):
entry = self.conn.getEntry(dn, ldap.SCOPE_BASE)
- objectclass = entry.getValues("objectclass")
+ objectclass = entry.get("objectclass")
for o in objectclass:
if o.lower() == "nsdswindowsreplicationagreement":
diff --git a/ipaserver/install/service.py b/ipaserver/install/service.py
index cea3d4101..e01415987 100644
--- a/ipaserver/install/service.py
+++ b/ipaserver/install/service.py
@@ -197,7 +197,7 @@ class Service(object):
hostdn = DN(('fqdn', self.fqdn), ('cn', 'computers'), ('cn', 'accounts'), self.suffix)
self.admin_conn.deleteEntry(dn)
entry.dn = newdn
- classes = entry.getValues("objectclass")
+ classes = entry.get("objectclass")
classes = classes + ["ipaobject", "ipaservice", "pkiuser"]
entry.setValues("objectclass", list(set(classes)))
entry.setValue("ipauniqueid", 'autogenerate')
diff --git a/ipaserver/ipaldap.py b/ipaserver/ipaldap.py
index 0724e2246..8a4e7ee98 100644
--- a/ipaserver/ipaldap.py
+++ b/ipaserver/ipaldap.py
@@ -697,11 +697,6 @@ class LDAPEntry(dict):
yield self._dn
yield self
- def getValues(self, name):
- # FIXME: for backwards compatibility only
- """Get the list (array) of values for the attribute named name"""
- return self.data.get(name)
-
def getValue(self, name, default=None):
# FIXME: for backwards compatibility only
"""Get the first value for the attribute named name"""