mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02:00
[PR #7264/fc530cd3 backport][stable-7] ldap_search: make sure to also handle binary strings in Python 3 (#7268)
ldap_search: make sure to also handle binary strings in Python 3 (#7264)
Make sure to also handle binary strings in Python 3.
(cherry picked from commit fc530cd3f5
)
Co-authored-by: Felix Fontein <felix@fontein.de>
This commit is contained in:
parent
417db583e7
commit
f6722c142d
2 changed files with 4 additions and 2 deletions
2
changelogs/fragments/7264-ldap_search-strings.yml
Normal file
2
changelogs/fragments/7264-ldap_search-strings.yml
Normal file
|
@ -0,0 +1,2 @@
|
|||
bugfixes:
|
||||
- "ldap_search - fix string normalization and the ``base64_attributes`` option on Python 3 (https://github.com/ansible-collections/community.general/issues/5704, https://github.com/ansible-collections/community.general/pull/7264)."
|
|
@ -120,7 +120,7 @@ import traceback
|
|||
|
||||
from ansible.module_utils.basic import AnsibleModule, missing_required_lib
|
||||
from ansible.module_utils.common.text.converters import to_bytes, to_native, to_text
|
||||
from ansible.module_utils.six import string_types, text_type
|
||||
from ansible.module_utils.six import binary_type, string_types, text_type
|
||||
from ansible_collections.community.general.plugins.module_utils.ldap import LdapGeneric, gen_specs, ldap_required_together
|
||||
|
||||
LDAP_IMP_ERR = None
|
||||
|
@ -159,7 +159,7 @@ def main():
|
|||
|
||||
|
||||
def _normalize_string(val, convert_to_base64):
|
||||
if isinstance(val, string_types):
|
||||
if isinstance(val, (string_types, binary_type)):
|
||||
if isinstance(val, text_type):
|
||||
val = to_bytes(val, encoding='utf-8')
|
||||
if convert_to_base64:
|
||||
|
|
Loading…
Reference in a new issue