copy: clearer comments, filenames, task names (tests)

This commit is contained in:
Pierre-Louis Bonicoli 2017-08-13 14:40:22 +02:00 committed by Toshio Kuratomi
parent 6f47b3e9e8
commit efd17915f1
3 changed files with 11 additions and 9 deletions

View file

@ -1,10 +1,11 @@
# src is a file, dest is a non-existent directory: checks that dest is created
- name: Ensure that dest directory doesn't exist
# src is a file, dest is a non-existent directory (2 levels of directories):
# checks that dest is created
- name: Ensure that dest top directory doesn't exist
file:
path: '{{ remote_dir }}/new_sub_dir1/'
state: absent
- name: Copy file, dest is a non-existing target directory
- name: Copy file, dest is a nonexistent target directory
copy:
src: '{{ item.src }}'
dest: '{{ remote_dir }}/new_sub_dir1/{{ item.dest }}'
@ -16,12 +17,12 @@
- 'copy_result|success'
- 'copy_result|changed'
- name: stat the copied path
- name: stat copied file
stat:
path: '{{ remote_dir }}/new_sub_dir1/sub_dir2/{{ item.check }}'
register: stat_file_in_dir_result
- name: assert that the file exists
- name: assert that file exists
assert:
that:
- stat_file_in_dir_result.stat.exists

View file

@ -1,4 +1,4 @@
- name: Ensure that dest directory doesn't exist
- name: Ensure that dest top directory doesn't exist
file:
path: '{{ remote_dir }}/new_sub_dir1'
state: absent
@ -15,7 +15,7 @@
that:
- 'copy_result|failed'
- name: Stat the dest
- name: Stat dest path
stat:
path: '{{ remote_dir }}/new_sub_dir1'
register: stat_file_in_dir_result

View file

@ -927,8 +927,9 @@
- stat_circular_symlink_result.stat.exists
- stat_circular_symlink_result.stat.islnk
# src is a file, dest is a non-existent directory: checks that dest is created
- include: dest_in_non_existent_dir.yml
# src is a file, dest is a non-existent directory (2 levels of directories):
# checks that dest is created
- include: dest_in_non_existent_directories.yml
with_items:
- { src: 'foo.txt', dest: 'sub_dir2/', check: 'foo.txt' }
- { src: 'subdir', dest: 'sub_dir2/', check: 'subdir/bar.txt' }