mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-07-22 12:50:22 -07:00
Add check_mode to get_url (#20532)
* Add check_mode to get_url that does a HEAD request to make sure the URL exists, but doesn't write the real file * Add info about new --check behavior to docs. Add tests for the new behavior. Populate res_args with the info the tests are looking for. * Add trailing comma * Change nonexistent test URL to http://{{httpbin_host}/DOESNOTEXIST. Fix spacing while I'm at it * Further spacing cleanup * State that this functionality is in Ansible 2.4+
This commit is contained in:
parent
ca7616b4a1
commit
3f321e7591
2 changed files with 37 additions and 2 deletions
|
@ -65,6 +65,28 @@
|
|||
that:
|
||||
- result.failed
|
||||
|
||||
- name: test HTTP HEAD request for file in check mode
|
||||
get_url: url="http://{{ httpbin_host }}/get" dest={{ output_dir }}/get_url_check.txt force=yes
|
||||
check_mode: True
|
||||
register: result
|
||||
|
||||
- name: assert that the HEAD request was successful in check mode
|
||||
assert:
|
||||
that:
|
||||
- result.changed
|
||||
- '"OK" in result.msg'
|
||||
|
||||
- name: test HTTP HEAD for nonexistent URL in check mode
|
||||
get_url: url="http://{{ httpbin_host }}/DOESNOTEXIST" dest={{ output_dir }}/shouldnotexist.html force=yes
|
||||
check_mode: True
|
||||
register: result
|
||||
ignore_errors: True
|
||||
|
||||
- name: assert that HEAD request for nonexistent URL failed
|
||||
assert:
|
||||
that:
|
||||
- result.failed
|
||||
|
||||
- name: test https fetch
|
||||
get_url: url="https://{{ httpbin_host }}/get" dest={{output_dir}}/get_url.txt force=yes
|
||||
register: result
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue