Howdy –
I’ve got a case where Chef’s attribute behaviour is very contrary to my
expectations.
{
“override”: {
“shorewall”: {
“private_ranges”: [
“192.168.0.0/16”
]
}
},
“default”: {
“shorewall”: {
“private_ranges”: [
“192.168.0.0/16”,
“172.16.0.0/12”,
“10.0.0.0/8”
]
}
}
}
My expectation here, and the behavior I saw in 0.9.x, was that
node[:shorewall][:private_ranges] will be the single-item list assigned at
the override level.
However, in Chef 0.10.2, running shef -z:
chef > node[:shorewall][:private_ranges]
=> [“192.168.0.0/16”, “172.16.0.0/12”, “10.0.0.0/8”]
chef > node.override[:shorewall][:private_ranges]
=> #<Chef::Node::Attribute @auto_vivifiy_on_read=true, @automatic={…},
@override={…}, @current_default=[“192.168.0.0/16”, “172.16.0.0/12”, “
10.0.0.0/8”], @has_been_read=false, @current_nesting_level=[:shorewall,
:private_ranges], @normal={…}, @current_normal={}, @set_type=:override,
@current_automatic={}, @default={…}, @set_unless_value_present=false,
@current_override={}>
What’s going on here?
Hi Charles,
This sounds a lot like this bug: http://tickets.opscode.com/browse/CHEF-2467
You can check if attributes are applied correctly in a chef client run to
confirm this is related, as this bug only effects shef runs.
Thanks,
Jessica
On Tue, Aug 16, 2011 at 12:06 PM, Charles Duffy charles@dyfis.net wrote:
Howdy --
I've got a case where Chef's attribute behaviour is very contrary to my
expectations.
{
"override": {
"shorewall": {
"private_ranges": [
"192.168.0.0/16"
]
}
},
"default": {
"shorewall": {
"private_ranges": [
"192.168.0.0/16",
"172.16.0.0/12",
"10.0.0.0/8"
]
}
}
}
My expectation here, and the behavior I saw in 0.9.x, was that
node[:shorewall][:private_ranges] will be the single-item list assigned at
the override level.
However, in Chef 0.10.2, running shef -z:
chef > node[:shorewall][:private_ranges]
=> ["192.168.0.0/16", "172.16.0.0/12", "10.0.0.0/8"]
chef > node.override[:shorewall][:private_ranges]
=> #<Chef::Node::Attribute @auto_vivifiy_on_read=true, @automatic={...},
@override={...}, @current_default=["192.168.0.0/16", "172.16.0.0/12", "
10.0.0.0/8"], @has_been_read=false, @current_nesting_level=[:shorewall,
:private_ranges], @normal={...}, @current_normal={}, @set_type=:override,
@current_automatic={}, @default={...}, @set_unless_value_present=false,
@current_override={}>
What's going on here?