mirror of
https://github.com/ansible-collections/community.general.git
synced 2026-05-06 13:22:48 +00:00
Update file.py's initial_diff() to list existing when state: absent (#56353)
This commit is contained in:
@@ -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
|
||||
|
||||
|
||||
Reference in New Issue
Block a user