Replace to_native with to_text. (#897)

This commit is contained in:
Felix Fontein
2025-05-18 01:31:33 +02:00
committed by GitHub
parent 9b8e4e81a9
commit 7294841a28
19 changed files with 48 additions and 48 deletions

View File

@@ -424,7 +424,7 @@ import typing as t
from base64 import b64decode
from ansible.module_utils.basic import AnsibleModule
from ansible.module_utils.common.text.converters import to_bytes, to_native
from ansible.module_utils.common.text.converters import to_bytes, to_text
# used to get <luks-name> out of lsblk output in format 'crypt <luks-name>'
@@ -487,7 +487,7 @@ class Handler:
if self._passphrase_encoding == "text":
return to_bytes(passphrase)
try:
return b64decode(to_native(passphrase))
return b64decode(to_text(passphrase))
except Exception as exc:
self._module.fail_json(
f"Error while base64-decoding '{parameter_name}': {exc}"