summaryrefslogtreecommitdiff
path: root/test/integration/targets/file
diff options
context:
space:
mode:
authorIain Madder <31111103+Taoquitok@users.noreply.github.com>2019-06-07 14:55:51 +0100
committerSam Doran <sdoran@redhat.com>2019-06-07 09:55:51 -0400
commit91d326cb68de876cda915683f6b072e5d82bd2c2 (patch)
tree0fbb5d6c24850c22e0d4558edb3e71e159dd0705 /test/integration/targets/file
parentfba67bbe5372a9886d14e1e81ff52aae03930d0d (diff)
downloadansible-91d326cb68de876cda915683f6b072e5d82bd2c2.tar.gz
Update file.py's initial_diff() to list existing when state: absent (#56353)
Diffstat (limited to 'test/integration/targets/file')
-rw-r--r--test/integration/targets/file/tasks/main.yml20
1 files changed, 19 insertions, 1 deletions
diff --git a/test/integration/targets/file/tasks/main.yml b/test/integration/targets/file/tasks/main.yml
index 2c473329d2..6c03f5a8ab 100644
--- a/test/integration/targets/file/tasks/main.yml
+++ b/test/integration/targets/file/tasks/main.yml
@@ -243,7 +243,7 @@
when: selinux_installed.stdout != ""
ignore_errors: true
-- name: remote directory foobar
+- name: remove directory foobar
file: path={{output_dir}}/foobar state=absent
- name: remove file foo.txt
@@ -258,6 +258,24 @@
- name: copy directory structure over
copy: src=foobar dest={{output_dir}}
+- name: check what would be removed if folder state was absent and diff is enabled
+ file:
+ path: "{{ output_dir }}"
+ state: absent
+ check_mode: yes
+ diff: yes
+ register: folder_absent_result
+
+- name: assert that the absent check lists expected files and folders
+ assert:
+ that:
+ - folder_absent_result.diff.before.path_content is defined
+ - test_folder in folder_absent_result.diff.before.path_content.directories
+ - test_file in folder_absent_result.diff.before.path_content.files
+ vars:
+ test_folder: "{{ folder_absent_result.path }}/foobar"
+ test_file: "{{ folder_absent_result.path }}/foobar/fileA"
+
- name: Change ownership of a directory with recurse=no(default)
file: path={{output_dir}}/foobar owner=1234