Hi,
I’m hoping this very simple as i can find lots of examples… I just can’t get it to work with the number of attribute names [] i’m using.
e.g
if in master cookbook I have the following in an attribute file :
default[‘MyApplication’][‘SubComponent’][‘PrimaryInstance’][‘ID’] ='1’
default[‘MyApplication’][‘SubComponent’][‘SecondaryInstance’][‘ID’] =‘2’
In my wrapper cookbook I have a role called “NodeB”. I want to use this to override the ID with 3 & 4 like this :
default[‘MyApplication’][‘SubComponent’][‘PrimaryInstance’][‘ID’] ='3’
default[‘MyApplication’][‘SubComponent’][‘SecondaryInstance’][‘ID’] =‘4’
I’ve tried the following as a json file to create the role :
{
“name”: “MyApplication”,
“json_class”: “Chef::Role”,
“description”: “Ensures ID is unique”,
“run_list”: [“recipe[MyApplication::server_instance1]”,“recipe[MyApplication::instance2]”],
“override_attributes”: (“MyApplication” => {“SubComponent” => {“PrimaryInstance” => {“ID” => “3”}}})
“override_attributes”: (“MyApplication” => {“SubComponent” => {“SecondaryInstance” => {“ID” => “4”}}})
}
but this fails.
There are lots of examples on the internet when the attributes have fewer sections but cant seem to get this to work where I have four.
Many thanks for anyone who’s able to take a look at this and suggest a fix.
D