From 198f1e1bea668010d26c8ee327df214904c36891 Mon Sep 17 00:00:00 2001 From: Jordan Borean Date: Fri, 7 Dec 2018 08:29:12 +1000 Subject: [PATCH] Revert "Fixes #49362 module dnf: install python3-dnf preferably over python2-dnf. (#49402)" (#49633) This reverts commit 3247eec97ac249ef77a3130ae96cc11093871cc9. --- lib/ansible/modules/packaging/os/dnf.py | 6 +-- test/integration/targets/dnf/tasks/main.yml | 4 -- .../targets/dnf/tasks/python3and2.yml | 44 ------------------- 3 files changed, 3 insertions(+), 51 deletions(-) delete mode 100644 test/integration/targets/dnf/tasks/python3and2.yml diff --git a/lib/ansible/modules/packaging/os/dnf.py b/lib/ansible/modules/packaging/os/dnf.py index 02dc9edb66a..d8c2e14787e 100644 --- a/lib/ansible/modules/packaging/os/dnf.py +++ b/lib/ansible/modules/packaging/os/dnf.py @@ -464,10 +464,10 @@ class DnfModule(YumDnf): def _ensure_dnf(self): if not HAS_DNF: - if not PY2: - package = 'python3-dnf' - else: + if PY2: package = 'python2-dnf' + else: + package = 'python3-dnf' if self.module.check_mode: self.module.fail_json( diff --git a/test/integration/targets/dnf/tasks/main.yml b/test/integration/targets/dnf/tasks/main.yml index 92e35611ebb..aba860fe5a1 100644 --- a/test/integration/targets/dnf/tasks/main.yml +++ b/test/integration/targets/dnf/tasks/main.yml @@ -43,7 +43,3 @@ when: - ansible_distribution == 'Fedora' and ansible_distribution_major_version|int >= 29 - ansible_distribution == 'RedHat' and ansible_distribution_major_version|int >= 8 - -- include: 'python3and2.yml' - when: - - ansible_pkg_mgr == 'dnf' diff --git a/test/integration/targets/dnf/tasks/python3and2.yml b/test/integration/targets/dnf/tasks/python3and2.yml deleted file mode 100644 index dd59b90f2b7..00000000000 --- a/test/integration/targets/dnf/tasks/python3and2.yml +++ /dev/null @@ -1,44 +0,0 @@ -# INSTALLPYTHON3AND2 -# The module `dnf` installs python3-dnf on python3 systems and python2-dnf -# on python2 systems. Fedora 30 and newer have python3 and limited -# support for python2, for example python2-dnf is missing. -# This test proves that python3 and python2 can be installed and the module -# `dnf` works. - -- name: install python2 - dnf: - name: python2 - state: present - -- name: use python2 - set_fact: - ansible_python_interpreter: /usr/bin/python - -- name: install a sample package - dnf: - name: screen - state: present - -- name: clean up sample package - dnf: - name: screen - state: absent - -- name: install python3 - dnf: - name: python3 - state: present - -- name: use python3 - set_fact: - ansible_python_interpreter: /usr/bin/python3 - -- name: install a sample package - dnf: - name: screen - state: present - -- name: clean up sample package - dnf: - name: screen - state: absent