How do attributes in nested roles work?


#1

I can’t wrap my head around it, so I have to ask: How do attributes
work in the context of nesting roles?

The behavior I see on 0.10.6 on Ruby 1.8.7 and 0.10.10 on Ruby 1.9.1
(omnibus) under SL 6.1 is unexpected. Specifically, I have a role, A,
included in my node’s run_list. That role includes another role, B.
In role B, I set a default_attribute overriding a cookbook default
attribute. The run is a solo run, so the node has no normal attribute
set.

When I do the run, the attribute is the cookbook default. If I
instead set the default_attribute in role A, it overrides the value in
the cookbook.

Is this the behavior I should expect? Do attributes propagate from
leaf roles up through to the node? Could it be because I am using
solo?

Thanks.


Thursday next week is indeed time for a thorough insight
into the swirling red debian vortex. — leeta


#2

Never mind. Reading comprehension problem on my part. Multiple calls
to default_attributes in a roll override, rather than collect, prior
attributes.

On Fri, Jun 8, 2012 at 7:59 PM, Jason Boxman jasonb@edseek.com wrote:

I can’t wrap my head around it, so I have to ask: How do attributes
work in the context of nesting roles?

The behavior I see on 0.10.6 on Ruby 1.8.7 and 0.10.10 on Ruby 1.9.1
(omnibus) under SL 6.1 is unexpected. Specifically, I have a role, A,
included in my node’s run_list. That role includes another role, B.
In role B, I set a default_attribute overriding a cookbook default
attribute. The run is a solo run, so the node has no normal attribute
set.

When I do the run, the attribute is the cookbook default. If I
instead set the default_attribute in role A, it overrides the value in
the cookbook.

Is this the behavior I should expect? Do attributes propagate from
leaf roles up through to the node? Could it be because I am using
solo?

Thanks.


Thursday next week is indeed time for a thorough insight
into the swirling red debian vortex. — leeta


Thursday next week is indeed time for a thorough insight
into the swirling red debian vortex. — leeta