mirror of
https://salsa.debian.org/freeipa-team/freeipa.git
synced 2025-01-11 00:31:56 -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]
|
||||
|
||||
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(
|
||||
|
Loading…
Reference in New Issue
Block a user