Join GitHub today
GitHub is home to over 40 million developers working together to host and review code, manage projects, and build software together.Sign up
Unlike in version 2.8.5, get_url module repeatedly downloads an URL even if destination exists with Ansible 2.8.6
OS / ENVIRONMENT
STEPS TO REPRODUCE
$ touch foofile $ cat > test_playbook.yaml --- - hosts: localhost connection: local tasks: - name: Fetch file get_url: url: http://google.com dest: ./foofile force: no $ ansible-playbook -i 'localhost,' test_playbook.yaml
No changes, since "foofile" already exists. With the same playbook, a run with Ansible 2.8.5 results in:
File gets overwritten/downloaded every time
There was a bug in <2.8.6 where we assumed no checksum was a checksum match. I think we need to further improve the logic to account for this situation too.
Maybe something like:
diff --git a/lib/ansible/modules/net_tools/basics/get_url.py b/lib/ansible/modules/net_tools/basics/get_url.py index 3c84cb60e9..3fb72dbe84 100644 --- a/lib/ansible/modules/net_tools/basics/get_url.py +++ b/lib/ansible/modules/net_tools/basics/get_url.py @@ -540,7 +540,7 @@ def main(): checksum_mismatch = True # Not forcing redownload, unless checksum does not match - if not force and checksum and not checksum_mismatch: + if not force and (not checksum or (checksum and not checksum_mismatch)): # Not forcing redownload, unless checksum does not match # allow file attribute changes module.params['path'] = dest
More integration tests would need added.
The test failures seem to come from the following commit: