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
Fix docs get_url dest comment. Checksum does not prevent download. #73185
Conversation
doesn't the checksum indicate if the content changed? |
Content of what? |
For the record. The file is unconditionally downloaded but the description of the parameters indicates the possibility of avoiding the download
It would probably be better to say: "The file will always be downloaded." Notes:
|
@bcoca Can you respond here or approve the docs change? thanks. |
The code was updated. Now, it would be easier to test the checksum when dest is a directory before the download. |
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.
This is accurate. We can't compare the checksum until we have the destination filename. If dest is a directory the url is fetched to determine the filename (which may come from either the headers or the URL).
Thanks @vbotka for the Ansible docs fix! |
SUMMARY
Checksum does not prevent download if dest is dir. It's not clear from the documentation.
get_url checksum says:
get_url dest says:
The block comparing the checksum is skipped if dest is a directory
https://github.com/ansible/ansible/blob/devel/lib/ansible/modules/get_url.py#L539
ISSUE TYPE
COMPONENT NAME
get_url
ADDITIONAL INFORMATION
It's easier to put a directory into dest and let get_url complete the path. Quoting from dest comment:
Unfortunately, in this case, the checksum of the existing file is not compared and the file is downloaded. A simple solution is to document it:
Verified scenario