mirror of
https://salsa.debian.org/freeipa-team/freeipa.git
synced 2025-02-25 18:55:28 -06:00
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>
This commit is contained in:
parent
387a1513bb
commit
b24787a67f
@ -119,10 +119,10 @@ def safe_output(attr, values):
|
|||||||
values = [values]
|
values = [values]
|
||||||
|
|
||||||
try:
|
try:
|
||||||
all(v.decode('ascii') for v in values)
|
values = [v.decode('ascii') for v in values]
|
||||||
except UnicodeDecodeError:
|
except UnicodeDecodeError:
|
||||||
try:
|
try:
|
||||||
values = [base64.b64encode(v) for v in values]
|
values = [base64.b64encode(v).decode('ascii') for v in values]
|
||||||
except TypeError:
|
except TypeError:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
@ -656,7 +656,9 @@ class LDAPUpdate(object):
|
|||||||
try:
|
try:
|
||||||
entry_values.remove(update_value)
|
entry_values.remove(update_value)
|
||||||
except ValueError:
|
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:
|
else:
|
||||||
entry[attr] = entry_values
|
entry[attr] = entry_values
|
||||||
self.debug('remove: updated value %s', safe_output(
|
self.debug('remove: updated value %s', safe_output(
|
||||||
|
Loading…
Reference in New Issue
Block a user