Hello guys,
I have this env json:
{
"chef_type": "environment",
"cookbook_versions": {},
"default_attributes": {
"test_cookbook": {
"roles": {
"role1": {
"description": "Some description for role1 atribute",
"permissions": "read"
},
"role2": {
"description": "Some description for role2 atribute",
"permissions": "write"
}
}
}
},
"description": "Test environment",
"json_class": "Chef::Environment",
"name": "Test",
"override_attributes": {}
}
I’m trying to put the value of role1’s permissions in some variable so i can use it in a loop afterwhile.
What I have until now is:
roles_var = node['test_cookbook']['roles']
roles_var.each_with_index { |val,index| puts "index: #{index} for #{val} }
But I still don’t know how to get the 'permissions'
for each role.
Little help please.
Thank you,