fix dnf wildcard pkg removal - fixes #27744 and #36970 (#45357)

Signed-off-by: Adam Miller <admiller@redhat.com>
pull/45929/head
Adam Miller 6 years ago committed by ansibot
parent cb460dee74
commit 2fe150a1ef

@ -1,3 +1,4 @@
---
minor_changes:
- "dnf - group removal does not work if group was installed with Ansible because of dnf upstream bug https://bugzilla.redhat.com/show_bug.cgi?id=1620324"
- "dnf removal with wildcards now works: Fixes https://github.com/ansible/ansible/issues/27744"

@ -548,13 +548,15 @@ class DnfModule(YumDnf):
# Disable repositories
for repo_pattern in disablerepo:
for repo in repos.get_matching(repo_pattern):
repo.disable()
if repo_pattern:
for repo in repos.get_matching(repo_pattern):
repo.disable()
# Enable repositories
for repo_pattern in enablerepo:
for repo in repos.get_matching(repo_pattern):
repo.enable()
if repo_pattern:
for repo in repos.get_matching(repo_pattern):
repo.enable()
def _base(self, conf_file, disable_gpg_check, disablerepo, enablerepo, installroot):
"""Return a fully configured dnf Base object."""
@ -944,7 +946,7 @@ class DnfModule(YumDnf):
installed = self.base.sack.query().installed()
for pkg_spec in pkg_specs:
if installed.filter(name=pkg_spec):
if ("*" in pkg_spec) or installed.filter(name=pkg_spec):
self.base.remove(pkg_spec)
# Like the dnf CLI we want to allow recursive removal of dependent

Loading…
Cancel
Save