diff --git a/lib/ansible/modules/dnf.py b/lib/ansible/modules/dnf.py index 593f006eb86..fb9fa6ae5d2 100644 --- a/lib/ansible/modules/dnf.py +++ b/lib/ansible/modules/dnf.py @@ -288,8 +288,7 @@ notes: removal the module is unable to detect that the group is installed (https://bugzilla.redhat.com/show_bug.cgi?id=1620324) requirements: - - "python >= 2.6" - - python-dnf + - python3-dnf - for the autoremove option you need dnf >= 2.0.1" author: - Igor Gnatenko (@ignatenkobrain) @@ -500,7 +499,6 @@ class DnfModule(YumDnf): system_interpreters = ['/usr/libexec/platform-python', '/usr/bin/python3', - '/usr/bin/python2', '/usr/bin/python'] if not has_respawned(): @@ -515,7 +513,7 @@ class DnfModule(YumDnf): # done all we can do, something is just broken (auto-install isn't useful anymore with respawn, so it was removed) self.module.fail_json( msg="Could not import the dnf python module using {0} ({1}). " - "Please install `python3-dnf` or `python2-dnf` package or ensure you have specified the " + "Please install `python3-dnf` package or ensure you have specified the " "correct ansible_python_interpreter. (attempted {2})" .format(sys.executable, sys.version.replace('\n', ''), system_interpreters), results=[] diff --git a/lib/ansible/modules/dnf5.py b/lib/ansible/modules/dnf5.py index 2fa09b2b8df..cd8e6d2c668 100644 --- a/lib/ansible/modules/dnf5.py +++ b/lib/ansible/modules/dnf5.py @@ -243,7 +243,6 @@ attributes: platform: platforms: rhel requirements: - - "python3" - "python3-libdnf5" version_added: 2.15 """ @@ -453,7 +452,6 @@ class Dnf5Module(YumDnf): system_interpreters = [ "/usr/libexec/platform-python", "/usr/bin/python3", - "/usr/bin/python2", "/usr/bin/python", ] @@ -477,12 +475,6 @@ class Dnf5Module(YumDnf): ) def run(self): - if sys.version_info.major < 3: - self.module.fail_json( - msg="The dnf5 module requires Python 3.", - failures=[], - rc=1, - ) if not self.list and not self.download_only and os.geteuid() != 0: self.module.fail_json( msg="This command has to be run under the root user.",