I have a list of veriables in node file in cookbook as
"normal": {
"Data_list": 'one, two, three, four',
"tags": [
]
}
based on this list i want to add values to template , below is the source fro same , but it seems instead of running case and if statement ,it is adding all the logic as it is in template as simple text.
<%= [node['data_list']].each do |data|
case data
when 'one'
"this is one and this will be added in template"
when 'two'
"this is two and this will be added in template"
when 'three'
"this is three and this will be added in template"
when 'four'
"this is four and this will be added in template"
default
"this is default and this will be added in template"
end
end %>
any help to identify where i am doing wrong will be much helpful
The JSON data for data_list is set as a single string and not an array. If I understand your question correctly, I think you need to use this as your JSON data: