copy: clearer parameter values (tests)

This commit is contained in:
Pierre-Louis Bonicoli 2017-08-13 14:44:40 +02:00 committed by Toshio Kuratomi
parent efd17915f1
commit 022d45cb52
3 changed files with 13 additions and 13 deletions

View file

@ -2,13 +2,13 @@
# checks that dest is created
- name: Ensure that dest top directory doesn't exist
file:
path: '{{ remote_dir }}/new_sub_dir1/'
path: '{{ remote_dir }}/{{ item.dest.split("/")[0] }}'
state: absent
- name: Copy file, dest is a nonexistent target directory
copy:
src: '{{ item.src }}'
dest: '{{ remote_dir }}/new_sub_dir1/{{ item.dest }}'
dest: '{{ remote_dir }}/{{ item.dest }}'
register: copy_result
- name: assert copy worked
@ -19,7 +19,7 @@
- name: stat copied file
stat:
path: '{{ remote_dir }}/new_sub_dir1/sub_dir2/{{ item.check }}'
path: '{{ remote_dir }}/{{ item.check }}'
register: stat_file_in_dir_result
- name: assert that file exists

View file

@ -1,12 +1,12 @@
- name: Ensure that dest top directory doesn't exist
file:
path: '{{ remote_dir }}/new_sub_dir1'
path: '{{ remote_dir }}/{{ dest.split("/")[0] }}'
state: absent
- name: Copy file, dest is a file in non-existing target directory
copy:
src: foo.txt
dest: '{{ dest }}'
dest: '{{ remote_dir }}/{{ dest }}'
register: copy_result
ignore_errors: True
@ -17,7 +17,7 @@
- name: Stat dest path
stat:
path: '{{ remote_dir }}/new_sub_dir1'
path: '{{ remote_dir }}/{{ dest.split("/")[0] }}'
register: stat_file_in_dir_result
- name: assert that dest doesn't exist

View file

@ -931,16 +931,16 @@
# 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' }
- { src: 'subdir/', dest: 'sub_dir2/', check: 'bar.txt' }
- { src: 'subdir', dest: 'sub_dir2', check: 'subdir/bar.txt' }
- { src: 'subdir/', dest: 'sub_dir2', check: 'bar.txt' }
- { src: 'foo.txt', dest: 'new_sub_dir1/sub_dir2/', check: 'new_sub_dir1/sub_dir2/foo.txt' }
- { src: 'subdir', dest: 'new_sub_dir1/sub_dir2/', check: 'new_sub_dir1/sub_dir2/subdir/bar.txt' }
- { src: 'subdir/', dest: 'new_sub_dir1/sub_dir2/', check: 'new_sub_dir1/sub_dir2/bar.txt' }
- { src: 'subdir', dest: 'new_sub_dir1/sub_dir2', check: 'new_sub_dir1/sub_dir2/subdir/bar.txt' }
- { src: 'subdir/', dest: 'new_sub_dir1/sub_dir2', check: 'new_sub_dir1/sub_dir2/bar.txt' }
# src is a file, dest is file in a non-existent directory: checks that a failure occurs
- include: src_file_dest_file_in_non_existent_dir.yml
with_items:
- '{{ remote_dir }}/new_sub_dir1/sub_dir2/foo.txt'
- '{{ remote_dir }}/new_sub_dir1/foo.txt'
- 'new_sub_dir1/sub_dir2/foo.txt'
- 'new_sub_dir1/foo.txt'
loop_control:
loop_var: 'dest'