apt: better error msg when update_cache fails (#37410)

This commit is contained in:
Martin Krizek 2018-03-15 17:32:25 +01:00 committed by GitHub
commit a6d31b6fb1
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 27 additions and 3 deletions

View file

@ -162,6 +162,29 @@
- "not apt_result.changed"
- "apt_result.failed"
# https://github.com/ansible/ansible/issues/23155
- name: create a repo file
copy:
dest: /etc/apt/sources.list.d/non-existing.list
content: deb http://ppa.launchpad.net/non-existing trusty main
- name: test for sane error message
apt:
update_cache: yes
register: apt_result
ignore_errors: yes
- name: verify sane error message
assert:
that:
- "'E:Failed to fetch' in apt_result['msg']"
- "'403' in apt_result['msg']"
- name: Clean up
file:
name: /etc/apt/sources.list.d/non-existing.list
state: absent
- name: autoclean during install
apt: pkg=hello state=present autoclean=yes