1
0
Fork 0
mirror of https://github.com/ansible-collections/community.general.git synced 2024-09-14 20:13:21 +02:00

Enable test for lookups on python 3

Since passlib algo sometime takes a bytes, and sometime
not, depending on a internal variable, we have to convert
bnased on it, or it fail with "TypeError: salt must be bytes,
not str" (or unicode instead of bytes)

However, that's not great to use internal structure for that.
This commit is contained in:
Michael Scherer 2016-10-17 01:14:57 +02:00 committed by Toshio Kuratomi
parent fbe0e6c9a2
commit 578da9a615
2 changed files with 3 additions and 2 deletions

View file

@ -67,7 +67,7 @@ except ImportError:
from ansible import constants as C
from ansible.errors import AnsibleError
from ansible.module_utils._text import to_text
from ansible.module_utils._text import to_text, to_native
__all__ = ['do_encrypt']
@ -84,6 +84,8 @@ def do_encrypt(result, encrypt, salt_size=None, salt=None):
if salt_size:
result = crypt.encrypt(result, salt_size=salt_size)
elif salt:
if not crypt._salt_is_bytes:
salt = to_native(salt)
result = crypt.encrypt(result, salt=salt)
else:
result = crypt.encrypt(result)

View file

@ -1,7 +1,6 @@
test_filters
test_git
test_hg
test_lookups
test_pip
test_service
test_uri