From 461f30c16012b7c6f2421047a44ef0e2d842617e Mon Sep 17 00:00:00 2001 From: Martin Krizek Date: Mon, 13 Dec 2021 17:38:20 +0100 Subject: [PATCH] yum: avoid storing unnecessary cache data (#76345) Fixes #76336 --- changelogs/fragments/76336-yum-makecache-fast.yml | 2 ++ lib/ansible/modules/yum.py | 6 +++--- 2 files changed, 5 insertions(+), 3 deletions(-) create mode 100644 changelogs/fragments/76336-yum-makecache-fast.yml diff --git a/changelogs/fragments/76336-yum-makecache-fast.yml b/changelogs/fragments/76336-yum-makecache-fast.yml new file mode 100644 index 00000000000..1b6a154cafb --- /dev/null +++ b/changelogs/fragments/76336-yum-makecache-fast.yml @@ -0,0 +1,2 @@ +bugfixes: + - yum - prevent storing unnecessary cache data by running `yum makecache fast` (https://github.com/ansible/ansible/issues/76336) diff --git a/lib/ansible/modules/yum.py b/lib/ansible/modules/yum.py index ef0b3140886..8b9517c656d 100644 --- a/lib/ansible/modules/yum.py +++ b/lib/ansible/modules/yum.py @@ -748,13 +748,13 @@ class YumModule(YumDnf): # 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: