mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02:00
Add python 3 awareness to apt module tests. (#17574)
Also remove unnecessary dependency from ubuntu1604py3 Dockerfile.
This commit is contained in:
parent
bcb49fecb5
commit
7b3cbafbe9
2 changed files with 15 additions and 5 deletions
|
@ -1,15 +1,26 @@
|
||||||
|
- name: show python version
|
||||||
|
debug: var=ansible_python_version
|
||||||
|
|
||||||
|
- name: use python-apt
|
||||||
|
set_fact:
|
||||||
|
python_apt: python-apt
|
||||||
|
when: ansible_python_version | version_compare('3', '<')
|
||||||
|
|
||||||
|
- name: use python3-apt
|
||||||
|
set_fact:
|
||||||
|
python_apt: python3-apt
|
||||||
|
when: ansible_python_version | version_compare('3', '>=')
|
||||||
|
|
||||||
# UNINSTALL 'python-apt'
|
# UNINSTALL 'python-apt'
|
||||||
# The `apt` module has the smarts to auto-install `python-apt`. To test, we
|
# The `apt` module has the smarts to auto-install `python-apt`. To test, we
|
||||||
# will first uninstall `python-apt`.
|
# will first uninstall `python-apt`.
|
||||||
- name: check python-apt with dpkg
|
- name: check {{ python_apt }} with dpkg
|
||||||
shell: dpkg -s python-apt
|
shell: dpkg -s {{ python_apt }}
|
||||||
register: dpkg_result
|
register: dpkg_result
|
||||||
ignore_errors: true
|
ignore_errors: true
|
||||||
|
|
||||||
- name: uninstall python-apt with apt
|
- name: uninstall {{ python_apt }} with apt
|
||||||
apt: pkg=python-apt state=absent purge=yes
|
apt: pkg={{ python_apt }} state=absent purge=yes
|
||||||
register: apt_result
|
register: apt_result
|
||||||
when: dpkg_result|success
|
when: dpkg_result|success
|
||||||
|
|
||||||
|
|
|
@ -22,7 +22,6 @@ RUN apt-get update -y && \
|
||||||
mysql-server \
|
mysql-server \
|
||||||
openssh-client \
|
openssh-client \
|
||||||
openssh-server \
|
openssh-server \
|
||||||
python3-apt \
|
|
||||||
python3-coverage \
|
python3-coverage \
|
||||||
python3-dbus \
|
python3-dbus \
|
||||||
python3-httplib2 \
|
python3-httplib2 \
|
||||||
|
|
Loading…
Reference in a new issue