[stable-2.16] dnf: obey the keepcache setting (#82735) (#82964)

Fixes #81954
(cherry picked from commit 77ab7af)

Co-authored-by: Martin Krizek <martin.krizek@gmail.com>
This commit is contained in:
Matt Martz
2024-04-10 14:07:38 -05:00
committed by GitHub
co-authored by Martin Krizek
parent 5a3bcd4bac
commit bdf45d1fbc
3 changed files with 17 additions and 2 deletions
@@ -0,0 +1,2 @@
bugfixes:
- "dnf - fix an issue when cached RPMs were left in the cache directory even when the keepcache setting was unset (https://github.com/ansible/ansible/issues/81954)"
+4 -2
View File
@@ -1441,8 +1441,10 @@ class DnfModule(YumDnf):
if self.with_modules:
self.module_base = dnf.module.module_base.ModuleBase(self.base)
self.ensure()
try:
self.ensure()
finally:
self.base.close()
def main():
@@ -67,6 +67,17 @@
update_cache: True
register: dnf_result
- find:
paths: /var/cache/dnf
patterns: "*.rpm"
recurse: true
register: r
- name: verify that RPM cache is cleared after installation as keepcache is off by default
assert:
that:
- r.matched == 0
- name: check sos with rpm
shell: rpm -q sos
failed_when: False