suppose i have an attribute as shown below
default[‘a’][‘b’][‘z’] = [{ name: ‘x1’, type: ‘d’ }, { name: ‘y’, type: ‘d’ }, { name: ‘z’, type: ‘d’ }]
How do i overide this on an environment file , i tried adding below attribute into environment file
and its treating as a string
“a": {
“b": {
“c”: “[{ :name => ‘x1’, :type => ‘d’ }, { :name => ‘y1’, :type => ‘d’ }, { :name => ‘z1’, :type => ‘d’ }]”
}
},
You didn’t mention if you were updating a ruby environment or a json one, so below are what you’d expect to see for both of those, per the docs.
In JSON -
{
"name": "dev",
"default_attributes": {
"a": {
"b": {
"c": [{
"name": "x1",
"type": "d"
}, {
"name": "y1",
"type": "d"
}, {
"name": "z1",
"type": "d"
}]
}
}
},
"json_class": "Chef::Environment",
"description": "The development environment",
"cookbook_versions": {
"my_test_cookbook": "= 1.2.0"
},
"chef_type": "environment"
}
[In Ruby](json -
name 'dev'
description 'The development environment'
cookbook_versions 'my_test_cookbook' => '= 1.2.0'
default_attributes 'a' => { 'b' => {'c' => [ {:name => 'x1', :type => 'd'}, {:name => 'y1', :type => 'd'}, {:name => 'z1', :type => 'd'}]} }