mirror of
https://github.com/ansible-collections/community.general.git
synced 2026-05-08 22:33:25 +00:00
fix decrypted vault utf8 values (#37539)
* Fix errors decrypted non-ascii vault vars AnsibleVaultEncryptedUnicode was just using b"".decode() instead of to_text() on the bytestrings returned from vault.decrypt() and could cause errors on python2 if non-ascii since decode() defaults to ascii. Use to_text() to default to decoding utf-8. add intg and unit tests for value of vaulted vars being non-ascii utf8 based on https://github.com/ansible/ansible/issues/37258 Fixes #37258 * yamllint fixups
This commit is contained in:
@@ -104,7 +104,7 @@ class AnsibleVaultEncryptedUnicode(yaml.YAMLObject, AnsibleBaseYAMLObject):
|
||||
if not self.vault:
|
||||
# FIXME: raise exception?
|
||||
return self._ciphertext
|
||||
return self.vault.decrypt(self._ciphertext).decode()
|
||||
return to_text(self.vault.decrypt(self._ciphertext))
|
||||
|
||||
@data.setter
|
||||
def data(self, value):
|
||||
|
||||
Reference in New Issue
Block a user