fix #7244 recursive copy fails when setting directory attributes

- reverse the order of new_directory_list returned from split_pre_existing_dir in copy module
pull/7245/head
someda 11 years ago
parent 6069d5d4cf
commit 50080b3774

@ -111,7 +111,7 @@ def split_pre_existing_dir(dirname):
(pre_existing_dir, new_directory_list) = split_pre_existing_dir(head)
else:
return (head, [ tail ])
new_directory_list.insert(0, tail)
new_directory_list.append(tail)
return (pre_existing_dir, new_directory_list)

@ -99,7 +99,7 @@
file: name={{output_subdir}} state=directory
- name: test recursive copy to directory
copy: src=subdir dest={{output_subdir}}
copy: src=subdir dest={{output_subdir}} directory_mode=0700
register: recursive_copy_result
- debug: var=recursive_copy_result
@ -112,11 +112,32 @@
stat: path={{output_dir}}/sub/subdir/subdir2/baz.txt
register: stat_bar2
- name: check that a file in a directory whose parent contains a directory alone was transferred
stat: path={{output_dir}}/sub/subdir/subdir2/subdir3/subdir4/qux.txt
register: stat_bar3
- name: assert recursive copy things
assert:
that:
- "stat_bar.stat.exists"
- "stat_bar2.stat.exists"
- "stat_bar3.stat.exists"
- name: stat the recursively copied directories
stat: path={{output_dir}}/sub/{{item}}
register: dir_stats
with_items:
- "subdir"
- "subdir/subdir2"
- "subdir/subdir2/subdir3"
- "subdir/subdir2/subdir3/subdir4"
- name: assert recursive copied directories mode
assert:
that:
- "{{item.stat.mode}} == 0700"
with_items: dir_stats.results
# errors on this aren't presently ignored so this test is commented out. But it would be nice to fix.
#

Loading…
Cancel
Save