diff options
author | Iain Madder <31111103+Taoquitok@users.noreply.github.com> | 2019-06-07 15:55:51 +0200 |
---|---|---|
committer | Sam Doran <sdoran@redhat.com> | 2019-06-07 15:55:51 +0200 |
commit | 91d326cb68de876cda915683f6b072e5d82bd2c2 (patch) | |
tree | 0fbb5d6c24850c22e0d4558edb3e71e159dd0705 /test/integration/targets/file | |
parent | Updated documentation for zabbix-screen module (#57325) (diff) | |
download | ansible-91d326cb68de876cda915683f6b072e5d82bd2c2.tar.xz ansible-91d326cb68de876cda915683f6b072e5d82bd2c2.zip |
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.yml | 20 |
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 |