mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02:00
ldap_attr: Use byte values instead of str (#41248)
The LDAP values may be of any kind (pictures, bytes, etc.) thus, ldap module enforce a "bytes" type. We should pass properly encoded values instead of str Fixes: #39569 Signed-off-by: Abhijeet Kasurde <akasurde@redhat.com>
This commit is contained in:
parent
effa235eb6
commit
e3a073fdb9
1 changed files with 3 additions and 3 deletions
|
@ -152,7 +152,7 @@ modlist:
|
|||
import traceback
|
||||
|
||||
from ansible.module_utils.basic import AnsibleModule
|
||||
from ansible.module_utils._text import to_native
|
||||
from ansible.module_utils._text import to_native, to_bytes
|
||||
from ansible.module_utils.ldap import LdapGeneric, gen_specs
|
||||
|
||||
try:
|
||||
|
@ -173,9 +173,9 @@ class LdapAttr(LdapGeneric):
|
|||
|
||||
# Normalize values
|
||||
if isinstance(self.module.params['values'], list):
|
||||
self.values = map(str, self.module.params['values'])
|
||||
self.values = map(to_bytes, self.module.params['values'])
|
||||
else:
|
||||
self.values = [str(self.module.params['values'])]
|
||||
self.values = [to_bytes(self.module.params['values'])]
|
||||
|
||||
def add(self):
|
||||
values_to_add = filter(self._is_value_absent, self.values)
|
||||
|
|
Loading…
Reference in a new issue