override_attributes confusion


#1

Hello,

I’m a little confused with the usage of override_attributes in a role DSL
file not taking effect.

I have this in my role file (ruby-DSL-style):

override_attributes “apache2” => { “listen_ports” => [ “80” ],
“max_children” => “50” }

I can see these configs taking effect in the WebUI (or knife node show
nodename -a apache2), but the ports.conf file still show configs for 443,
even after deleting the file before a chef-client runs to make sure it’s
re-rewritten.

Is there something I need to do in my cookbook recipes to activate that? For
now, I’m only doing the include_recipe and subsequent web_app calls.

Thanks for any tips

Benoit


#2

That is not the intended behavior, I just came across this bug myself with attributes not reflecting the correct state during runtime, even though it seems the mash that persists for the node and in my cookbooks/roles all contain the correct entries.


Sahil R Cooner

On Thursday, September 22, 2011 at 12:33 PM, Benoit Caron wrote:

Hello,

I’m a little confused with the usage of override_attributes in a role DSL file not taking effect.

I have this in my role file (ruby-DSL-style):

override_attributes “apache2” => { “listen_ports” => [ “80” ], “max_children” => “50” }

I can see these configs taking effect in the WebUI (or knife node show nodename -a apache2), but the ports.conf file still show configs for 443, even after deleting the file before a chef-client runs to make sure it’s re-rewritten.

Is there something I need to do in my cookbook recipes to activate that? For now, I’m only doing the include_recipe and subsequent web_app calls.

Thanks for any tips

Benoit


#3

If you are seeing this sort of behavior, it’s because something else
is setting those attributes, or you are reading them somewhere in the
chef run where they have yet to be applied (for example, in an
attribute file where you want to compute a value based on something
that comes from a role.)

Best,
Adam

On Thu, Sep 22, 2011 at 12:37 PM, Sahil R Cooner sahil.cooner@gmail.com wrote:

That is not the intended behavior, I just came across this bug myself with
attributes not reflecting the correct state during runtime, even though it
seems the mash that persists for the node and in my cookbooks/roles all
contain the correct entries.

Sahil R Cooner

On Thursday, September 22, 2011 at 12:33 PM, Benoit Caron wrote:

Hello,
I’m a little confused with the usage of override_attributes in a role DSL
file not taking effect.
I have this in my role file (ruby-DSL-style):
override_attributes “apache2” => { “listen_ports” => [ “80” ],
“max_children” => “50” }
I can see these configs taking effect in the WebUI (or knife node show
nodename -a apache2), but the ports.conf file still show configs for 443,
even after deleting the file before a chef-client runs to make sure it’s
re-rewritten.
Is there something I need to do in my cookbook recipes to activate that? For
now, I’m only doing the include_recipe and subsequent web_app calls.
Thanks for any tips
Benoit


Opscode, Inc.
Adam Jacob, Chief Product Officer
T: (206) 619-7151 E: adam@opscode.com