* Move update_cache to after self.yum_baseurl definition (#56613)
(cherry picked from commit e13566140a
)
* Add changelog
This commit is contained in:
parent
171ef3e337
commit
f0e5f2cad0
2 changed files with 13 additions and 11 deletions
2
changelogs/fragments/56638-yum-update_cache-fix.yaml
Normal file
2
changelogs/fragments/56638-yum-update_cache-fix.yaml
Normal file
|
@ -0,0 +1,2 @@
|
|||
bugfixes:
|
||||
- yum - fix failure when using ``update_cache`` standalone (https://github.com/ansible/ansible/issues/56638)
|
|
@ -1494,6 +1494,17 @@ class YumModule(YumDnf):
|
|||
if error_msgs:
|
||||
self.module.fail_json(msg='. '.join(error_msgs))
|
||||
|
||||
# fedora will redirect yum to dnf, which has incompatibilities
|
||||
# with how this module expects yum to operate. If yum-deprecated
|
||||
# is available, use that instead to emulate the old behaviors.
|
||||
if self.module.get_bin_path('yum-deprecated'):
|
||||
yumbin = self.module.get_bin_path('yum-deprecated')
|
||||
else:
|
||||
yumbin = self.module.get_bin_path('yum')
|
||||
|
||||
# need debug level 2 to get 'Nothing to do' for groupinstall.
|
||||
self.yum_basecmd = [yumbin, '-d', '2', '-y']
|
||||
|
||||
if self.update_cache and not self.names and not self.list:
|
||||
rc, stdout, stderr = self.module.run_command(self.yum_basecmd + ['clean', 'expire-cache'])
|
||||
if rc == 0:
|
||||
|
@ -1511,17 +1522,6 @@ class YumModule(YumDnf):
|
|||
results=[stderr],
|
||||
)
|
||||
|
||||
# fedora will redirect yum to dnf, which has incompatibilities
|
||||
# with how this module expects yum to operate. If yum-deprecated
|
||||
# is available, use that instead to emulate the old behaviors.
|
||||
if self.module.get_bin_path('yum-deprecated'):
|
||||
yumbin = self.module.get_bin_path('yum-deprecated')
|
||||
else:
|
||||
yumbin = self.module.get_bin_path('yum')
|
||||
|
||||
# need debug level 2 to get 'Nothing to do' for groupinstall.
|
||||
self.yum_basecmd = [yumbin, '-d', '2', '-y']
|
||||
|
||||
repoquerybin = self.module.get_bin_path('repoquery', required=False)
|
||||
|
||||
if self.install_repoquery and not repoquerybin and not self.module.check_mode:
|
||||
|
|
Loading…
Reference in a new issue