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:
Cambell 2016-01-22 23:23:10 +07:00 committed by Brian Coca
parent 776bffb52b
commit cdf6e3e4bf
5 changed files with 89 additions and 4 deletions

View file

@ -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)