Make fetch default to fail on errors

Fixes #23501
This commit is contained in:
Toshio Kuratomi 2017-04-17 10:55:56 -07:00
commit a0dfa8616a
5 changed files with 48 additions and 18 deletions

View file

@ -56,7 +56,7 @@
- 'fetched["checksum"] == "a94a8fe5ccb19ba61c4c0873d391e987982fbbd3"'
- name: attempt to fetch a non-existent file - do not fail on missing
fetch: src={{ output_dir }}/doesnotexist dest={{ output_dir }}/fetched
fetch: src={{ output_dir }}/doesnotexist dest={{ output_dir }}/fetched fail_on_missing=False
register: fetch_missing_nofail
- name: check fetch missing no fail result
@ -78,7 +78,7 @@
- "not fetch_missing|changed"
- name: attempt to fetch a directory - should not fail but return a message
fetch: src={{ output_dir }} dest={{ output_dir }}/somedir
fetch: src={{ output_dir }} dest={{ output_dir }}/somedir fail_on_missing=False
register: fetch_dir
- name: check fetch directory result
@ -87,6 +87,17 @@
- "not fetch_dir|changed"
- "fetch_dir.msg"
- name: attempt to fetch a directory - should fail
fetch: src={{ output_dir }} dest={{ output_dir }}/somedir fail_on_missing=True
register: failed_fetch_dir
ignore_errors: true
- name: check fetch directory result
assert:
that:
- "failed_fetch_dir['failed']"
- "fetch_dir.msg"
- name: create symlink to a file that we can fetch
file:
path: "{{ output_dir }}/link"