yum is Python 2 only. If Python 3 use dnf (#37140)

* PY3 = dnf

Red Hat are unlikely to provide a Python 2 version of the yum bindings
as they are moving to `dnf`.

If Ansible can't find the yum Python library give the user a hint about
dnf and Python 3
pull/37249/head
John R Barker 7 years ago committed by GitHub
parent 2a0971435f
commit 6c8d40f653
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -21,6 +21,7 @@ version_added: historical
short_description: Manages packages with the I(yum) package manager
description:
- Installs, upgrade, downgrades, removes, and lists packages and groups with the I(yum) package manager.
- This module only works on Python 2. If you require Python 3 support see the M(dnf) module.
options:
name:
description:
@ -1342,9 +1343,9 @@ def main():
error_msgs = []
if not HAS_RPM_PYTHON:
error_msgs.append('python2 bindings for rpm are needed for this module')
error_msgs.append('The Python 2 bindings for rpm are needed for this module. If you require Python 3 support use the `dnf` Ansible module instead.')
if not HAS_YUM_PYTHON:
error_msgs.append('python2 yum module is needed for this module')
error_msgs.append('The Python 2 yum module is needed for this module. If you require Python 3 support use the `dnf` Ansible module instead.')
if error_msgs:
module.fail_json(msg='. '.join(error_msgs))

Loading…
Cancel
Save