ruby - Passing node attributes into chef-apply -


is there way pass attributes chef-apply run of cookbook?

the first line of cookbook is:

if node[:my_attr][:enabled] 

which leads to:

nomethoderror: undefined method '[]' nil:nilclass 

when run

chef-apply recipes/default.rb 

adding appropriate attributes attributes/default.rb not fix problem, neither adding initialization node[:my_attr] = {}.

how can pass node attributes chef-apply run?

in attributes/default.rb declare

default['my_attr']['enabled']= "value" 

then able access them in recipe

you can pass value of attribute using chef-client -j option.


Comments

Popular posts from this blog

java - activate/deactivate sonar maven plugin by profile? -

python - TypeError: can only concatenate tuple (not "float") to tuple -

java - What is the difference between String. and String.this. ? -