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.
pull/18129/head
Michael Scherer 8 years ago committed by Toshio Kuratomi
parent fbe0e6c9a2
commit 578da9a615

@ -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)

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

Loading…
Cancel
Save