[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>
pull/83024/head
Matt Martz 2 years ago committed by GitHub
parent 5a3bcd4bac
commit bdf45d1fbc
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

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

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

Loading…
Cancel
Save