mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-07-24 13:50:22 -07:00
Adding "follow" param for file/copy options
Also modifies the template action plugin to use this new param when executing the file/copy modules for templating so that links are preserved correctly. Fixes #8998
This commit is contained in:
parent
79a2e586fe
commit
b376e208c7
7 changed files with 96 additions and 13 deletions
|
@ -160,6 +160,7 @@ def main():
|
|||
force = module.params['force']
|
||||
original_basename = module.params.get('original_basename',None)
|
||||
validate = module.params.get('validate',None)
|
||||
follow = module.params['follow']
|
||||
|
||||
if not os.path.exists(src):
|
||||
module.fail_json(msg="Source %s failed to transfer" % (src))
|
||||
|
@ -187,6 +188,8 @@ def main():
|
|||
adjust_recursive_directory_permissions(pre_existing_dir, new_directory_list, module, directory_args, changed)
|
||||
|
||||
if os.path.exists(dest):
|
||||
if os.path.islink(dest) and follow:
|
||||
dest = os.path.realpath(dest)
|
||||
if not force:
|
||||
module.exit_json(msg="file already exists", src=src, dest=dest, changed=False)
|
||||
if (os.path.isdir(dest)):
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue