Merge branch 'fix-copy-recursive-issue' of https://github.com/tksmd/ansible into tksmd-fix-copy-recursive-issue

This commit is contained in:
James Cammarata 2014-05-01 13:39:11 -05:00
commit ae7503d6fb
3 changed files with 24 additions and 2 deletions

View file

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

View file

@ -99,7 +99,7 @@
file: name={{output_subdir}} state=directory file: name={{output_subdir}} state=directory
- name: test recursive copy to 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 register: recursive_copy_result
- debug: var=recursive_copy_result - debug: var=recursive_copy_result
@ -112,11 +112,32 @@
stat: path={{output_dir}}/sub/subdir/subdir2/baz.txt stat: path={{output_dir}}/sub/subdir/subdir2/baz.txt
register: stat_bar2 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 - name: assert recursive copy things
assert: assert:
that: that:
- "stat_bar.stat.exists" - "stat_bar.stat.exists"
- "stat_bar2.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. # errors on this aren't presently ignored so this test is commented out. But it would be nice to fix.
# #