summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatt Clay <matt@mystile.com>2016-09-08 18:05:44 -0700
committerGitHub <noreply@github.com>2016-09-08 18:05:44 -0700
commit784810a84ccd22675426952e1465dc39964653a2 (patch)
treed95667bdb0c6cff218cfcd34e8d6e4f7072389f5
parenta1947401ba7311d3d976cd3a53a23eb885f937e4 (diff)
downloadansible-784810a84ccd22675426952e1465dc39964653a2.tar.gz
Add python 3 support to test_apt_repository. (#17472)
-rw-r--r--test/integration/roles/test_apt_repository/tasks/apt.yml21
1 files changed, 17 insertions, 4 deletions
diff --git a/test/integration/roles/test_apt_repository/tasks/apt.yml b/test/integration/roles/test_apt_repository/tasks/apt.yml
index cc520590df..4295badb16 100644
--- a/test/integration/roles/test_apt_repository/tasks/apt.yml
+++ b/test/integration/roles/test_apt_repository/tasks/apt.yml
@@ -6,16 +6,29 @@
test_ppa_spec: 'deb http://ppa.launchpad.net/git-core/ppa/ubuntu {{ansible_distribution_release}} main'
test_ppa_key: 'E1DF1F24' # http://keyserver.ubuntu.com:11371/pks/lookup?search=0xD06AAF4C11DAB86DF421421EFE6B20ECA7AD98A1&op=index
+- 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_repository` 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