mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-07-22 12:50:22 -07:00
fix file attributes changed detection
https://docs.python.org/2/library/stdtypes.html#str.split str.split([sep[, maxsplit]]) If sep is given, consecutive delimiters are not grouped together and are deemed to delimit empty strings. >>> "85563 ----------------C-- /var/lib/libvirt/images".split(' ')[0:2] ['85563', ''] >>> "85563 ----------------C-- /var/lib/libvirt/images".split()[0:2] ['85563', '----------------C--']
This commit is contained in:
parent
82cd5ffa1d
commit
c2ac9d0831
2 changed files with 20 additions and 6 deletions
|
@ -62,6 +62,22 @@
|
|||
- "file4_result.changed == true"
|
||||
- "file4_result.mode == '0600'"
|
||||
|
||||
- name: change file attribute "A"
|
||||
file: path={{output_dir}}/baz.txt attributes=A
|
||||
register: file_attributes_result
|
||||
ignore_errors: True
|
||||
|
||||
- name: reapply file attribute "A"
|
||||
file: path={{output_dir}}/baz.txt attributes=A
|
||||
register: file_attributes_result_2
|
||||
when: file_attributes_result is changed
|
||||
|
||||
- name: verify that the file was not marked as changed
|
||||
assert:
|
||||
that:
|
||||
- "file_attributes_result_2 is not changed"
|
||||
when: file_attributes_result is changed
|
||||
|
||||
- name: change ownership and group
|
||||
file: path={{output_dir}}/baz.txt owner=1234 group=1234
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue