mirror of
https://github.com/ansible-collections/community.general.git
synced 2026-05-06 21:32:49 +00:00
dnf: fix wildcard matching for state: absent (#56013)
* dnf: fix wildcard matching for state: absent Fixes #55938 * Add changelog... * Fix sanity check failure...
This commit is contained in:
@@ -1108,6 +1108,14 @@ class DnfModule(YumDnf):
|
||||
|
||||
installed = self.base.sack.query().installed()
|
||||
for pkg_spec in pkg_specs:
|
||||
# short-circuit installed check for wildcard matching
|
||||
if '*' in pkg_spec:
|
||||
try:
|
||||
self.base.remove(pkg_spec)
|
||||
except dnf.exceptions.MarkingError as e:
|
||||
failure_response['failures'].append('{0} - {1}'.format(pkg_spec, to_native(e)))
|
||||
continue
|
||||
|
||||
installed_pkg = list(map(str, installed.filter(name=pkg_spec).run()))
|
||||
if installed_pkg:
|
||||
candidate_pkg = self._packagename_dict(installed_pkg[0])
|
||||
|
||||
Reference in New Issue
Block a user