Test that file touch does not keep a new file if we failed to set its

attributes
pull/9012/head
Toshio Kuratomi 10 years ago
parent a44ea2d1b7
commit 49a6af1378

@ -65,6 +65,29 @@
- name: change ownership and group - name: change ownership and group
file: path={{output_dir}}/baz.txt owner=1234 group=1234 file: path={{output_dir}}/baz.txt owner=1234 group=1234
- name: setup a tmp-like directory for ownership test
file: path=/tmp/worldwritable mode=1777 state=directory
- name: Ask to create a file without enough perms to change ownership
file: path=/tmp/worldwritable/baz.txt state=touch owner=root
sudo: yes
sudo_user: nobody
register: chown_result
ignore_errors: True
- name: Ask whether the new file exists
stat: path=/tmp/worldwritable/baz.txt
register: file_exists_result
- name: Verify that the file doesn't exist on failure
assert:
that:
- "chown_result.failed == True"
- "file_exists_result.stat.exists == False"
- name: clean up
file: path=/tmp/worldwritable state=absent
- name: create soft link to file - name: create soft link to file
file: src={{output_file}} dest={{output_dir}}/soft.txt state=link file: src={{output_file}} dest={{output_dir}}/soft.txt state=link
register: file5_result register: file5_result

Loading…
Cancel
Save