[chef] Re: Re: Re: Re: How to set excludes in yum cookbook?


Chronological Thread 
  • From: Cooper Simmons < >
  • To:
  • Subject: [chef] Re: Re: Re: Re: How to set excludes in yum cookbook?
  • Date: Tue, 29 May 2012 23:38:22 -0500

w00t.
Thanks, Matt.

It was my misunderstanding of how an array attribute looks in json that was the issue. Thanks for showing me what it should look like.

Changing this:
  "override_attributes": {
    "yum": {
      "exclude": "kernel*",
      "installonlypkgs": {
      }
    }
  }
 
to your suggestion:
  "override_attributes": {
    "yum": {
      "exclude": [ "kernel*" ],
      "installonlypkgs": {
      }
    }
  }


Made it work.
Thanks again,
Cooper



On Tue, May 29, 2012 at 10:47 PM, Matthew Moretti < " target="_blank"> > wrote:
Just looking at it now, there seems to be some inconsistency in that cookbook.  The metadata file and the example in the comments of attributes/default.rb suggest that the attribute should be a string made up of space-separated arguments.  However, both templates call #join on it (which strings don't have)

It would seem that the attribute should be an array.  If so, it you would specify it with something like:


"override_attributes": {
    "yum": {
      "exclude": [ "kernel*" ],
      "installonlypkgs": {
      }
    }
  }


I think.  FWIW, I mostly stick with Ubuntu, so my familiarity with yum is only passable.

Matt Moretti

On Tue, May 29, 2012 at 11:22 PM, Cooper Simmons < " target="_blank"> > wrote:
I thought that's what I was doing with that json in the role:


  "override_attributes": {
    "yum": {
      "exclude": "kernel*",
      "installonlypkgs": {
      }
    }
  }


That entry is what causes the fatal error when I run chef-client on the node.
Is my json is set up wrong for this overriding attribute?

Thanks,
Cooper



On Tue, May 29, 2012 at 8:58 PM, Wolfe, Eric G < " target="_blank"> > wrote:
Pretty sure it is an array attribute. So you need to put something like ..yum.exclude = [ "kernel*" ] in your role.  It used to be a default of the recipe, if I am not mistaken.
sent from my phone, excuse any nonsensical autocorrect stuff.

Cooper Simmons < " target="_blank"> > wrote:



Hello.

I would like to exclude certain packages in my yum.conf file but I can't figure out how to do it with the Opscode yum cookbook.

I see this in attributes/default.rb:
# Example: override.yum.exclude = "kernel* compat-glibc*"
default[:yum][:exclude]

And this in templates/default/yum-rhel6.conf.erb:
<%- if node[:yum][:exclude] %>
exclude=<%= node[:yum][:exclude].join(" ") %>
<%- end %>

I tried putting this in the attributes:
default[:yum][:exclude] = "kernel*"

But that didn't do anything.
Not sure where to put the override.
I tried putting this in the role override_attributes:  https://gist.github.com/2832357
But that gave me a fatal error:
FATAL: Chef::Mixin::Template::TemplateError: undefined method `join' for "kernel*":String

Can anyone tell me how to add excludes to the yum.conf file with the yum cookbook?
Thanks,
Cooper







Archive powered by MHonArc 2.6.16.

§