Reputation: 14675
knife node show -l my-node -F json
returns:
{
"name": "my-node",
"chef_environment": "test"
..
}
We have created a template, info.txt.erb:
node = <%= node %>
name = <%= node['name'] %>
chef_environment = <%= node['chef_environment'] %>
Our recipe:
template "#{app_dir}/info.txt" do
source 'info.txt.erb'
...
end
After the chef run, the node has an info.txt file:
node = my-node
name =
chef_environment =
Why does the knife show <NODE>
command return something different than what is evaluated by the template file? How can I change the template file to get the correct information?
Upvotes: 0
Views: 337
Reputation: 54249
That should be node.name
and node.chef_environment
. They aren't attributes, so you can't use the attribute access syntax to get them.
Upvotes: 4