mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-07-09 14:50:02 -07:00
introduce module_utils.urls.fetch_file
as a wrapper to download and save files (#19172)
* module_utils.urls: add fetch_file function * apt: use fetch_file instead of own download() * unarchive: use fetch_file instead of own codecopy * apt: add test for deb=http://… * unarchive: add test for a remote file download and unarchive * yum: replace fetch_rpm_from_url by fetch_file * use NamedTemporaryFile * don't add a dot to fileext, it's already there
This commit is contained in:
parent
c8ed5c29e9
commit
7c66c90afc
6 changed files with 86 additions and 85 deletions
|
@ -590,3 +590,23 @@
|
|||
|
||||
- name: remove our tar.gz unarchive destination
|
||||
file: path={{ output_dir }}/test-unarchive-tar-gz state=absent
|
||||
|
||||
# Test downloading a file before unarchiving it
|
||||
- name: create our unarchive destination
|
||||
file: path={{output_dir}}/test-unarchive-tar-gz state=directory
|
||||
|
||||
- name: unarchive a tar from an URL
|
||||
unarchive:
|
||||
src: "https://releases.ansible.com/ansible/ansible-latest.tar.gz"
|
||||
dest: "{{ output_dir }}/test-unarchive-tar-gz"
|
||||
mode: "0700"
|
||||
remote_src: yes
|
||||
register: unarchive13
|
||||
|
||||
- name: Test that unarchive succeeded
|
||||
assert:
|
||||
that:
|
||||
- "unarchive13.changed == true"
|
||||
|
||||
- name: remove our tar.gz unarchive destination
|
||||
file: path={{ output_dir }}/test-unarchive-tar-gz state=absent
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue