Enabling/disabling yum repos

I’m trying to figure out how to enable and disable yum repos with the 3.x yum
and yum-* cookbooks.

I’ve tried this, but it doesn’t appear to be working:

node.default[‘yum’][‘rpmforge’][‘enabled’] = false
node.default[‘yum’][‘rpmforge’][‘managed’] = true
include_recipe ‘yum-repoforge’

Can anyone help with this?

Thanks.

Eric

Hi Eric.

I can't seem to reproduce this.... I would expect this to work the way
you tried.

I just spot checked this in test-kitchen:

suites:

  • name: default
    run_list:
    • recipe[yum-repoforge::default]
      attributes:
      yum:
      rpmforge:
      enabled: false

As expected....

  • update content in file /etc/yum.repos.d/rpmforge.repo from ce2b6c to 5f4f85
  • execute yum -q makecache --disablerepo=* --enablerepo=rpmforge
  • execute the ruby block yum-cache-reload-rpmforge

Next, I added a test wrapper cookbook and a bats test (currently in
master), to try and reproduce it.

and

https://github.com/opscode-cookbooks/yum-repoforge/blob/master/test/integration/includerecipe/bats/test_for_disabled.bats#L5

Everything looks good to me... Tested on el5 and el6.

-s

On Tue, Oct 21, 2014 at 11:43 AM, eric eberg@bergbrains.com wrote:

I'm trying to figure out how to enable and disable yum repos with the 3.x yum
and yum-* cookbooks.

I've tried this, but it doesn't appear to be working:

node.default['yum']['rpmforge']['enabled'] = false
node.default['yum']['rpmforge']['managed'] = true
include_recipe 'yum-repoforge'

Can anyone help with this?

Thanks.

Eric

JSON::GeneratorError

YAJL internal error: attempted use of non-string object as key

Cookbook Trace:

/opt/chef-server/embedded/cookbooks/chef-server/recipes/default.rb:90:in
block in from_file' /opt/chef-server/embedded/cookbooks/chef-server/recipes/default.rb:86:infrom_file’

Relevant File Content:

/opt/chef-server/embedded/cookbooks/chef-server/recipes/default.rb:

83:
84: include_recipe "chef-server::chef-pedant"
85:
86: file “/etc/chef-server/chef-server-running.json” do
87: owner node[‘chef_server’][‘user’][‘username’]
88: group "root"
89: mode "0600"
90>> content Chef::JSONCompat.to_json_pretty({ “chef_server” => node
[‘chef_server’].to_hash, “run_list” => node.run_list })
91: end
92:

JOHN HASTY
Software as a Service - DevOps
Software Group

Phone: 1-512-804-9968 IBM
E-mail: jahasty@us.ibm.com
2407 S Congress Ave Ste E-350
Austin, TX 78704
United States