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.
(cherry picked from commit 578da9a615
)
This commit is contained in:
parent
dcc6a15ce3
commit
b6e51d670a
2 changed files with 3 additions and 2 deletions
|
@ -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…
Reference in a new issue