1
0
Fork 0
mirror of https://github.com/ansible-collections/community.general.git synced 2024-09-14 20:13:21 +02:00

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

Signed-off-by: Adam Miller <admiller@redhat.com>
This commit is contained in:
Adam Miller 2018-09-20 11:13:17 -05:00 committed by ansibot
parent cb460dee74
commit 2fe150a1ef
2 changed files with 8 additions and 5 deletions

View file

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

View file

@ -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