summaryrefslogtreecommitdiffstats
path: root/ipaserver
diff options
context:
space:
mode:
authorMartin Basti <mbasti@redhat.com>2017-02-02 00:20:48 +0100
committerMartin Basti <mbasti@redhat.com>2017-02-08 18:09:49 +0100
commitb24787a67fd8b19b9222979a963a8f28b22153ee (patch)
treeb59ab07906b0f580d69f6b81be87db76811a94de /ipaserver
parent387a1513bb9dc0dc546753bfaa8a59aae8f30b83 (diff)
downloadfreeipa-b24787a67fd8b19b9222979a963a8f28b22153ee.tar.gz
freeipa-b24787a67fd8b19b9222979a963a8f28b22153ee.tar.xz
freeipa-b24787a67fd8b19b9222979a963a8f28b22153ee.zip
py3: ldapupdate: fix logging str(bytes) issue
bytes as argument of str() gives unexpected result by adding prefix "b" there. Also add missing safe_option() call to logging (it will fix another str(bytes) issue) https://fedorahosted.org/freeipa/ticket/4985 Reviewed-By: Martin Babinsky <mbabinsk@redhat.com>
Diffstat (limited to 'ipaserver')
-rw-r--r--ipaserver/install/ldapupdate.py8
1 files changed, 5 insertions, 3 deletions
diff --git a/ipaserver/install/ldapupdate.py b/ipaserver/install/ldapupdate.py
index bc2673b31..c6ab3e2af 100644
--- a/ipaserver/install/ldapupdate.py
+++ b/ipaserver/install/ldapupdate.py
@@ -119,10 +119,10 @@ def safe_output(attr, values):
values = [values]
try:
- all(v.decode('ascii') for v in values)
+ values = [v.decode('ascii') for v in values]
except UnicodeDecodeError:
try:
- values = [base64.b64encode(v) for v in values]
+ values = [base64.b64encode(v).decode('ascii') for v in values]
except TypeError:
pass
@@ -656,7 +656,9 @@ class LDAPUpdate(object):
try:
entry_values.remove(update_value)
except ValueError:
- self.debug("remove: '%s' not in %s", update_value, attr)
+ self.debug(
+ "remove: '%s' not in %s",
+ safe_output(attr, update_value), attr)
else:
entry[attr] = entry_values
self.debug('remove: updated value %s', safe_output(