Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug in yum.conf defaults affecting CentOS 5 #99

ice799 opened this issue Oct 15, 2014 · 4 comments


None yet
4 participants
Copy link

commented Oct 15, 2014


The default value of /var/cache/yum/$basearch/$releasever in ./attributes/main.rb does not actually have $basearch and $releasever substituted with their values on CentOS 5:

[vagrant@default-centos-510 $releasever]$ pwd
[vagrant@default-centos-510 $releasever]$ ls
base  epel  extras  updates

Which is not technically an invalid path, but it is a bit ugly and has some interesting side effects.


  • a repository is installed without using the yum cookbook (via a noarch rpm, which is a common way to install repo configs, or just directly as a file managed by chef in to /etc/yum.repos.d/)
  • the repository has a GPG key for either repository metadata or rpm signature checking
  • a repository is installed using the yum cookbook AFTER the above happens


  • the GPG keys will appear to have failed being imported

because the gpg keys are written to the cachedir, then the cachedir is overwritten by chef to be "/var/cache/yum/$basearch/$releasever", and so yum can't find keys written to the old cachedir.

Anyone using CentOS 6 or CentOS 7 wouldn't be affected because:

  • the default path on those systems is /var/cache/yum/$basearch/$releasever
  • the substitution actually works there.
  • 99.999...9% of people never touch /var/cache/yum/$basearch/$releasever so even when yum.conf gets overwritten by chef, it is overwritten to the default value where all the directories and keys and stuff already are.

On CentOS 5, the default path is: /var/cache/yum.

I'd suggest changing the default path to be /var/cache/yum in the yum cookbook for CentOS 5 and leaving the default path unchanged for CentOS 6 and 7 as it works fine as is.


This comment has been minimized.

Copy link

commented Oct 15, 2014

I believe that PR #100 resolves this, it adds the missing cachedir option. Would you please confirm on your system?


jtimberman added a commit that referenced this issue Oct 15, 2014

Dynamically generate the new_resource attributes
Issue #99 came up because an attribute for the `yum_globalconfig` was
left out - the cachedir. This commit updates the recipe to dynamically
walk the `node['yum']['main']` attributes and send each one with its
value to the new resource. This assures that all attributes defined
are passed into the configuration.

This *can* lead to an error if a user adds an attribute incorrectly.
That seems unlikely, though. I hope.

This comment has been minimized.

Copy link

commented Oct 15, 2014

PR #101 also resolves this, but completely refactors the recipe. It will dynamically walk node['yum']['main'] and send each key as an attribute to the resource with the value it's set to, if set.


This comment has been minimized.

Copy link

commented Oct 15, 2014

I can confirm that PR #101 fixes my issue on riak-cs-chef-cookbook for CentOS 5. 👍 and many thanks to @ice799 for digging into this one.


This comment has been minimized.

Copy link

commented Oct 15, 2014

Fix Merged in bc7f0ee. Released as 3.4.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.