mirror of
https://github.com/ansible-collections/community.general.git
synced 2026-05-06 21:32:49 +00:00
feature/copy-vault-dataloader: Add method get_real_file(file_path) to dataloader
- get_real_file will decrypt vault encrypted files and return a path to a temporary file. - cleanup_real_file will remove a temporary file created previously with get_real_file
This commit is contained in:
@@ -152,6 +152,8 @@ class ActionModule(ActionBase):
|
||||
diffs = []
|
||||
for source_full, source_rel in source_files:
|
||||
|
||||
source_full = self._loader.get_real_file(source_full)
|
||||
|
||||
# Generate a hash of the local file.
|
||||
local_checksum = checksum(source_full)
|
||||
|
||||
@@ -219,6 +221,8 @@ class ActionModule(ActionBase):
|
||||
# We have copied the file remotely and no longer require our content_tempfile
|
||||
self._remove_tempfile_if_content_defined(content, content_tempfile)
|
||||
|
||||
self._loader.cleanup_real_file(source_full)
|
||||
|
||||
# fix file permissions when the copy is done as a different user
|
||||
self._fixup_perms(tmp, remote_user, recursive=True)
|
||||
|
||||
@@ -247,6 +251,8 @@ class ActionModule(ActionBase):
|
||||
# the file module in case we want to change attributes
|
||||
self._remove_tempfile_if_content_defined(content, content_tempfile)
|
||||
|
||||
self._loader.cleanup_real_file(source_full)
|
||||
|
||||
if raw:
|
||||
# Continue to next iteration if raw is defined.
|
||||
self._remove_tmp_path(tmp)
|
||||
|
||||
Reference in New Issue
Block a user