mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02:00
copy: clearer comments, filenames, task names (tests)
This commit is contained in:
parent
6f47b3e9e8
commit
efd17915f1
3 changed files with 11 additions and 9 deletions
|
@ -1,10 +1,11 @@
|
||||||
# src is a file, dest is a non-existent directory: checks that dest is created
|
# src is a file, dest is a non-existent directory (2 levels of directories):
|
||||||
- name: Ensure that dest directory doesn't exist
|
# checks that dest is created
|
||||||
|
- name: Ensure that dest top directory doesn't exist
|
||||||
file:
|
file:
|
||||||
path: '{{ remote_dir }}/new_sub_dir1/'
|
path: '{{ remote_dir }}/new_sub_dir1/'
|
||||||
state: absent
|
state: absent
|
||||||
|
|
||||||
- name: Copy file, dest is a non-existing target directory
|
- name: Copy file, dest is a nonexistent target directory
|
||||||
copy:
|
copy:
|
||||||
src: '{{ item.src }}'
|
src: '{{ item.src }}'
|
||||||
dest: '{{ remote_dir }}/new_sub_dir1/{{ item.dest }}'
|
dest: '{{ remote_dir }}/new_sub_dir1/{{ item.dest }}'
|
||||||
|
@ -16,12 +17,12 @@
|
||||||
- 'copy_result|success'
|
- 'copy_result|success'
|
||||||
- 'copy_result|changed'
|
- 'copy_result|changed'
|
||||||
|
|
||||||
- name: stat the copied path
|
- name: stat copied file
|
||||||
stat:
|
stat:
|
||||||
path: '{{ remote_dir }}/new_sub_dir1/sub_dir2/{{ item.check }}'
|
path: '{{ remote_dir }}/new_sub_dir1/sub_dir2/{{ item.check }}'
|
||||||
register: stat_file_in_dir_result
|
register: stat_file_in_dir_result
|
||||||
|
|
||||||
- name: assert that the file exists
|
- name: assert that file exists
|
||||||
assert:
|
assert:
|
||||||
that:
|
that:
|
||||||
- stat_file_in_dir_result.stat.exists
|
- stat_file_in_dir_result.stat.exists
|
|
@ -1,4 +1,4 @@
|
||||||
- name: Ensure that dest directory doesn't exist
|
- name: Ensure that dest top directory doesn't exist
|
||||||
file:
|
file:
|
||||||
path: '{{ remote_dir }}/new_sub_dir1'
|
path: '{{ remote_dir }}/new_sub_dir1'
|
||||||
state: absent
|
state: absent
|
||||||
|
@ -15,7 +15,7 @@
|
||||||
that:
|
that:
|
||||||
- 'copy_result|failed'
|
- 'copy_result|failed'
|
||||||
|
|
||||||
- name: Stat the dest
|
- name: Stat dest path
|
||||||
stat:
|
stat:
|
||||||
path: '{{ remote_dir }}/new_sub_dir1'
|
path: '{{ remote_dir }}/new_sub_dir1'
|
||||||
register: stat_file_in_dir_result
|
register: stat_file_in_dir_result
|
||||||
|
|
|
@ -927,8 +927,9 @@
|
||||||
- stat_circular_symlink_result.stat.exists
|
- stat_circular_symlink_result.stat.exists
|
||||||
- stat_circular_symlink_result.stat.islnk
|
- stat_circular_symlink_result.stat.islnk
|
||||||
|
|
||||||
# src is a file, dest is a non-existent directory: checks that dest is created
|
# src is a file, dest is a non-existent directory (2 levels of directories):
|
||||||
- include: dest_in_non_existent_dir.yml
|
# checks that dest is created
|
||||||
|
- include: dest_in_non_existent_directories.yml
|
||||||
with_items:
|
with_items:
|
||||||
- { src: 'foo.txt', dest: 'sub_dir2/', check: 'foo.txt' }
|
- { src: 'foo.txt', dest: 'sub_dir2/', check: 'foo.txt' }
|
||||||
- { src: 'subdir', dest: 'sub_dir2/', check: 'subdir/bar.txt' }
|
- { src: 'subdir', dest: 'sub_dir2/', check: 'subdir/bar.txt' }
|
||||||
|
|
Loading…
Reference in a new issue