diff options
author | Toshio Kuratomi <toshio@fedoraproject.org> | 2016-02-02 10:39:19 -0800 |
---|---|---|
committer | Toshio Kuratomi <toshio@fedoraproject.org> | 2016-02-02 10:40:38 -0800 |
commit | b1e9dc0b52b3bb0d44bf78b6e3797dfc82e21fda (patch) | |
tree | df99d8db9de10e0c7b71356748524fb5feda61a8 /packaging/os | |
parent | 1b5c9ee7f9abe579ad8d79898e0cb52e73836ceb (diff) | |
download | ansible-modules-extras-b1e9dc0b52b3bb0d44bf78b6e3797dfc82e21fda.tar.gz |
Allow dnf to remove dependent packages of a package that is being removed
Fixes #1517
Diffstat (limited to 'packaging/os')
-rw-r--r-- | packaging/os/dnf.py | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/packaging/os/dnf.py b/packaging/os/dnf.py index 50c86fc4..56039258 100644 --- a/packaging/os/dnf.py +++ b/packaging/os/dnf.py @@ -234,6 +234,7 @@ def _mark_package_install(module, base, pkg_spec): def ensure(module, base, state, names): + allow_erasing = False if names == ['*'] and state == 'latest': base.upgrade_all() else: @@ -280,6 +281,7 @@ def ensure(module, base, state, names): _mark_package_install(module, base, pkg_spec) else: + # state == absent if filenames: module.fail_json( msg="Cannot remove paths -- please specify package name.") @@ -291,8 +293,11 @@ def ensure(module, base, state, names): for pkg_spec in pkg_specs: if installed.filter(name=pkg_spec): base.remove(pkg_spec) + # Like the dnf CLI we want to allow recursive removal of dependent + # packages + allow_erasing = True - if not base.resolve(): + if not base.resolve(allow_erasing=allow_erasing): module.exit_json(msg="Nothing to do") else: if module.check_mode: |