From 7b3cbafbe9d641beae3976c170b659769351b7b0 Mon Sep 17 00:00:00 2001 From: Matt Clay Date: Wed, 14 Sep 2016 15:38:27 -0700 Subject: [PATCH] Add python 3 awareness to apt module tests. (#17574) Also remove unnecessary dependency from ubuntu1604py3 Dockerfile. --- test/integration/roles/test_apt/tasks/apt.yml | 19 +++++++++++++++---- test/utils/docker/ubuntu1604py3/Dockerfile | 1 - 2 files changed, 15 insertions(+), 5 deletions(-) diff --git a/test/integration/roles/test_apt/tasks/apt.yml b/test/integration/roles/test_apt/tasks/apt.yml index 201404f6473..d293f845fa3 100644 --- a/test/integration/roles/test_apt/tasks/apt.yml +++ b/test/integration/roles/test_apt/tasks/apt.yml @@ -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' # The `apt` module has the smarts to auto-install `python-apt`. To test, we # will first uninstall `python-apt`. -- name: check python-apt with dpkg - shell: dpkg -s python-apt +- name: check {{ python_apt }} with dpkg + shell: dpkg -s {{ python_apt }} register: dpkg_result ignore_errors: true -- name: uninstall python-apt with apt - apt: pkg=python-apt state=absent purge=yes +- name: uninstall {{ python_apt }} with apt + apt: pkg={{ python_apt }} state=absent purge=yes register: apt_result when: dpkg_result|success diff --git a/test/utils/docker/ubuntu1604py3/Dockerfile b/test/utils/docker/ubuntu1604py3/Dockerfile index 28046be1f94..42c75d0bebc 100644 --- a/test/utils/docker/ubuntu1604py3/Dockerfile +++ b/test/utils/docker/ubuntu1604py3/Dockerfile @@ -22,7 +22,6 @@ RUN apt-get update -y && \ mysql-server \ openssh-client \ openssh-server \ - python3-apt \ python3-coverage \ python3-dbus \ python3-httplib2 \