From 9835b6a47733ca69e7230cce73188bde62c3868f Mon Sep 17 00:00:00 2001 From: Toshio Kuratomi Date: Fri, 4 Mar 2016 09:42:38 -0800 Subject: [PATCH] Fail due to no dnf module installed earlier as we use a dnf utility function to determine if we have permission to install packages. --- packaging/os/dnf.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/packaging/os/dnf.py b/packaging/os/dnf.py index efd17ef1eb5..2bd279785f6 100644 --- a/packaging/os/dnf.py +++ b/packaging/os/dnf.py @@ -129,7 +129,7 @@ def _fail_if_no_dnf(module): """Fail if unable to import dnf.""" if not HAS_DNF: module.fail_json( - msg="`python-dnf` is not installed, but it is required for the Ansible dnf module.") + msg="`python2-dnf` is not installed, but it is required for the Ansible dnf module.") def _configure_base(module, base, conf_file, disable_gpg_check): @@ -176,7 +176,6 @@ def _specify_repositories(base, disablerepo, enablerepo): def _base(module, conf_file, disable_gpg_check, disablerepo, enablerepo): """Return a fully configured dnf Base object.""" - _fail_if_no_dnf(module) base = dnf.Base() _configure_base(module, base, conf_file, disable_gpg_check) _specify_repositories(base, disablerepo, enablerepo) @@ -331,6 +330,8 @@ def main(): mutually_exclusive=[['name', 'list']], supports_check_mode=True) params = module.params + + _fail_if_no_dnf(module) if params['list']: base = _base( module, params['conf_file'], params['disable_gpg_check'],