Fixes for mode=preserve (#39343)

* Fixes for mode=preserve

* Document mode=preserve for template and copy
* Make mode=preserve work with remote_src for copy
* Make mode=preserve work for template
* Integration tests for copy & template mode=preserve

Fixes #39279

* Changed mode option in win_copy to hidden option as it doesn't reflect copy mode
This commit is contained in:
Toshio Kuratomi 2018-04-26 07:14:37 -07:00 committed by GitHub
commit 83c1cba511
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
9 changed files with 104 additions and 11 deletions

View file

@ -406,6 +406,27 @@
- "stat_results.stat.checksum == ('foo.txt\n'|hash('sha1'))"
- "stat_results.stat.mode == '0547'"
- name: Test copy with mode=preserve and remote_src=True
copy:
src: '{{ remote_dir }}/copy-foo.txt'
dest: '{{ remote_dir }}/copy-foo2.txt'
mode: 'preserve'
remote_src: True
register: copy_results2
- name: Check the stat results of the file
stat:
path: '{{ remote_dir }}/copy-foo2.txt'
register: stat_results2
- name: Assert that the file has changed and has correct mode
assert:
that:
- "copy_results2 is changed"
- "copy_results2.mode == '0547'"
- "stat_results2.stat.checksum == ('foo.txt\n'|hash('sha1'))"
- "stat_results2.stat.mode == '0547'"
#
# test recursive copy local_follow=False, no trailing slash
#