Remove Python 2 traces from dnf/dnf5 modules (#82985)

pull/82979/head
Martin Krizek 1 month ago committed by GitHub
parent 971c49b711
commit 14a2f6e2ab
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -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) <i.gnatenko.brain@gmail.com>
@ -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=[]

@ -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.",

Loading…
Cancel
Save