mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-04-24 11:21:25 -07:00
Fix copy to only follow symlinks for files in the non-recursive case
Revert "**Temporary**"
This reverts commit 28b86b1148
.
We don't need this now that copy has been fixed
This commit is contained in:
parent
9e028ab704
commit
f332151f59
5 changed files with 66 additions and 18 deletions
|
@ -192,9 +192,9 @@ class ActionModule(ActionBase):
|
|||
# remove action plugin only keys
|
||||
return dict((k, v) for k, v in module_args.items() if k not in ('content', 'decrypt'))
|
||||
|
||||
def _copy_file(self, source_full, source_rel, content, content_tempfile, dest, task_vars):
|
||||
def _copy_file(self, source_full, source_rel, content, content_tempfile,
|
||||
dest, task_vars, follow):
|
||||
decrypt = boolean(self._task.args.get('decrypt', True), strict=False)
|
||||
follow = boolean(self._task.args.get('follow', False), strict=False)
|
||||
force = boolean(self._task.args.get('force', 'yes'), strict=False)
|
||||
raw = boolean(self._task.args.get('raw', 'no'), strict=False)
|
||||
|
||||
|
@ -289,6 +289,7 @@ class ActionModule(ActionBase):
|
|||
src=tmp_src,
|
||||
dest=dest,
|
||||
original_basename=source_rel,
|
||||
follow=follow
|
||||
)
|
||||
)
|
||||
if not self._task.args.get('checksum'):
|
||||
|
@ -491,7 +492,14 @@ class ActionModule(ActionBase):
|
|||
for source_full, source_rel in source_files['files']:
|
||||
# copy files over. This happens first as directories that have
|
||||
# a file do not need to be created later
|
||||
module_return = self._copy_file(source_full, source_rel, content, content_tempfile, dest, task_vars)
|
||||
|
||||
# We only follow symlinks for files in the non-recursive case
|
||||
if source_files['directories']:
|
||||
follow = False
|
||||
else:
|
||||
follow = boolean(self._task.args.get('follow', False), strict=False)
|
||||
|
||||
module_return = self._copy_file(source_full, source_rel, content, content_tempfile, dest, task_vars, follow)
|
||||
if module_return is None:
|
||||
continue
|
||||
|
||||
|
@ -528,6 +536,9 @@ class ActionModule(ActionBase):
|
|||
new_module_args['src'] = target_path
|
||||
new_module_args['state'] = 'link'
|
||||
new_module_args['force'] = True
|
||||
# Only follow remote symlinks in the non-recursive case
|
||||
if source_files['directories']:
|
||||
new_module_args['follow'] = False
|
||||
|
||||
module_return = self._execute_module(module_name='file', module_args=new_module_args, task_vars=task_vars)
|
||||
module_executed = True
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue