mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-04-23 19:01:26 -07:00
fixed memoryerror when coping huge file (#16392)
* fixed * support both python 2 and 3
This commit is contained in:
parent
84c1697271
commit
adea1f2b80
2 changed files with 8 additions and 2 deletions
|
@ -380,11 +380,11 @@ class DataLoader():
|
|||
|
||||
try:
|
||||
with open(to_bytes(real_path), 'rb') as f:
|
||||
data = f.read()
|
||||
if self._vault.is_encrypted(data):
|
||||
if self._vault.is_encrypted(f):
|
||||
# if the file is encrypted and no password was specified,
|
||||
# the decrypt call would throw an error, but we check first
|
||||
# since the decrypt function doesn't know the file name
|
||||
data = f.read()
|
||||
if not self._vault_password:
|
||||
raise AnsibleParserError("A vault password must be specified to decrypt %s" % file_path)
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue