mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-07-22 12:50:22 -07:00
Unarchive should work when parent directory is not writable
Correct unarchive so that the checks for writeability are sensible. Added a test for when parent directory is not writable
This commit is contained in:
parent
2d54448064
commit
d9b895b319
2 changed files with 29 additions and 7 deletions
|
@ -110,4 +110,28 @@
|
|||
file: path={{output_dir}}/test-unarchive-zip state=absent
|
||||
|
||||
- name: remove our test file for the archive
|
||||
file: path={{output_dir}}/foo-unarchive.txt state=absent
|
||||
file: path={{output_dir}}/foo-unarchive.txt state=absent
|
||||
|
||||
- name: check if /tmp/foo-unarchive.text exists
|
||||
stat: path=/tmp/foo-unarchive.txt
|
||||
ignore_errors: True
|
||||
register: unarchive04
|
||||
|
||||
- name: fail if the proposed destination file exists for safey
|
||||
fail: msg="/tmp/foo-unarchive.txt already exists, aborting"
|
||||
when: unarchive04.stat.exists
|
||||
|
||||
- name: try unarchiving to /tmp
|
||||
unarchive: src={{output_dir}}/test-unarchive.tar.gz dest=/tmp copy=no
|
||||
register: unarchive05
|
||||
|
||||
- name: verify that the file was marked as changed
|
||||
assert:
|
||||
that:
|
||||
- "unarchive05.changed == true"
|
||||
|
||||
- name: verify that the file was unarchived
|
||||
file: path=/tmp/foo-unarchive.txt state=file
|
||||
|
||||
- name: remove our unarchive destination
|
||||
file: path=/tmp/foo-unarchive.txt state=absent
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue