Skip to content

Commit

Permalink
Add a check that tilde expansion with copy works
Browse files Browse the repository at this point in the history
  • Loading branch information
abadger committed Dec 4, 2014
1 parent 1eb3124 commit 57c7769
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 0 deletions.
1 change: 1 addition & 0 deletions test/integration/roles/test_sudo/files/baz.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
testing tilde expansion with sudo
19 changes: 19 additions & 0 deletions test/integration/roles/test_sudo/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
- assert:
that:
- "results.stat.exists == True"
- "results.stat.path|dirname|basename == '{{ sudo_test_user }}'"

- name: tilde expansion honors sudo in template
sudo: True
Expand All @@ -35,6 +36,24 @@
- assert:
that:
- "results.stat.exists == True"
- "results.stat.path|dirname|basename == '{{ sudo_test_user }}'"

- name: tilde expansion honors sudo in copy
sudo: True
sudo_user: "{{ sudo_test_user }}"
copy:
src: baz.txt
dest: "~/baz.txt"

- name: check that the path in the user's home dir was created
stat:
path: "~{{ sudo_test_user }}/baz.txt"
register: results

- assert:
that:
- "results.stat.exists == True"
- "results.stat.path|dirname|basename == '{{ sudo_test_user }}'"

- name: Remove test user and their home dir
user:
Expand Down

0 comments on commit 57c7769

Please sign in to comment.