@ -31,6 +31,57 @@
register : apt_result
when : dpkg_result is successful
# In check mode, auto-install of `python-apt` must fail
- name : test fail uninstall hello without required apt deps in check mode
apt:
pkg : hello
state : absent
purge : yes
register : apt_result
check_mode : yes
ignore_errors : yes
- name : verify fail uninstall hello without required apt deps in check mode
assert:
that:
- apt_result is failed
- '"If run normally this module can auto-install it." in apt_result.msg'
- name : check {{ python_apt }} with dpkg
shell : dpkg -s {{ python_apt }}
register : dpkg_result
ignore_errors : true
# UNINSTALL 'hello'
# With 'python-apt' uninstalled, the first call to 'apt' should install
# python-apt without updating the cache.
- name : uninstall hello with apt and prevent updating the cache
apt:
pkg : hello
state : absent
purge : yes
update_cache : no
register : apt_result
- name : check hello with dpkg
shell : dpkg-query -l hello
failed_when : False
register : dpkg_result
- name : verify uninstall hello with apt and prevent updating the cache
assert:
that:
- "'changed' in apt_result"
- apt_result is not changed
- "dpkg_result.rc == 1"
- "'Auto-installing missing dependency without updating cache: {{ python_apt }}' in apt_result.warnings"
- name : uninstall {{ python_apt }} with apt again
apt:
pkg : "{{ python_apt }}"
state : absent
purge : yes
# UNINSTALL 'hello'
# With 'python-apt' uninstalled, the first call to 'apt' should install
# python-apt.
@ -46,8 +97,10 @@
- name : verify uninstallation of hello
assert:
that:
- "'changed' in apt_result"
- "dpkg_result.rc == 1"
- "'changed' in apt_result"
- apt_result is not changed
- "dpkg_result.rc == 1"
- "'Updating cache and auto-installing missing dependency: {{ python_apt }}' in apt_result.warnings"
# UNINSTALL AGAIN
- name : uninstall hello with apt
@ -259,7 +312,7 @@
that:
- apt_result is not changed
# check policy_rc_d parameter
# check policy_rc_d parameter
- name : Install unscd but forbid service start
apt: