-
Notifications
You must be signed in to change notification settings - Fork 23.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Do not add state: absent when a non-existent path is returned in "path" or "dest" #51350
Do not add state: absent when a non-existent path is returned in "path" or "dest" #51350
Conversation
tempted to say the whole 'add_path_info' should not be automatically called, leave function as it is, but force the call only from specific modules instead of all (pass add_path_info=true? to _json functions?) |
I had no problem doing this myself though. I only needed to know if this would be accepted. |
@dag I can't let you have all the fun. 😉 |
Leave it up to the module to return the state in the results. I went through all the modules in files/ and only found one case where the module needed to return this. No other modules return paths that do not exists. Signed-off-by: Sam Doran <sdoran@redhat.com>
978a488
to
f49c3c7
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
@samdoran Is this ready to be merged ? |
@dag Yes, it's ready to be merged. Just trying to make tests happy though the failures seem unrelated to this PR. |
All green. Thanks again ! |
Ansible 2.8 does not return a "state" attribute if the file does not exist[1], so the task is changed to use stat instead. [1] ansible/ansible#51350 Change-Id: I166186b6d8abf84317ba98af949d4ed887618912
* Update openstack-ansible-lxc_hosts from branch 'master' - Use stat instead of file module for exists check Ansible 2.8 does not return a "state" attribute if the file does not exist[1], so the task is changed to use stat instead. [1] ansible/ansible#51350 Change-Id: I166186b6d8abf84317ba98af949d4ed887618912
SUMMARY
Leave it up to the module to return the state in the results.
I went through all the modules in
lib/ansible/modules/files/
and only found one case where the module needed to returnstate: absent
. No other modules return paths that do not exists and will therefore get the correct file type added byAnsibleModule.add_path_info()
.Signed-off-by: Sam Doran sdoran@redhat.com
Fixes #35382
ISSUE TYPE
COMPONENT NAME
lib/ansible/module_utils/basic.py
lib/ansible/modules/files/file.py