Skip to content

Commit

Permalink
yum: avoid storing unnecessary cache data (ansible#76345)
Browse files Browse the repository at this point in the history
  • Loading branch information
mkrizek authored and bcoca committed Dec 15, 2021
1 parent ed37f76 commit 74c4328
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
2 changes: 2 additions & 0 deletions changelogs/fragments/76336-yum-makecache-fast.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
bugfixes:
- yum - prevent storing unnecessary cache data by running `yum makecache fast` (https://github.com/ansible/ansible/issues/76336)
6 changes: 3 additions & 3 deletions lib/ansible/modules/yum.py
Original file line number Diff line number Diff line change
Expand Up @@ -748,13 +748,13 @@ def what_provides(self, repoq, req_spec, qf=def_qf):
# If a repo with `repo_gpgcheck=1` is added and the repo GPG
# key was never accepted, querying this repo will throw an
# error: 'repomd.xml signature could not be verified'. In that
# situation we need to run `yum -y makecache` which will accept
# situation we need to run `yum -y makecache fast` which will accept
# the key and try again.
if 'repomd.xml signature could not be verified' in to_native(e):
if self.releasever:
self.module.run_command(self.yum_basecmd + ['makecache'] + ['--releasever=%s' % self.releasever])
self.module.run_command(self.yum_basecmd + ['makecache', 'fast', '--releasever=%s' % self.releasever])
else:
self.module.run_command(self.yum_basecmd + ['makecache'])
self.module.run_command(self.yum_basecmd + ['makecache', 'fast'])
pkgs = self.yum_base.returnPackagesByDep(req_spec) + \
self.yum_base.returnInstalledPackagesByDep(req_spec)
else:
Expand Down

0 comments on commit 74c4328

Please sign in to comment.