Context . We have a huge number of chef attributes to complete our setup, now something like 3000+ is defined and changed for each environment.
Problem . Sometimes a chef's recipe will refer to a nonexistent attribute node[:mystuff][:typo]. This results in the following error:
Recipe Compile Error in /var/chef/cache/cookbooks/<yyy>/recipes/something.rb
undefined method '[]' for nil:NilClass
This is a useless error because it does not allow me to know for sure that node / attribute is missing. Even working with chef-client -l debugdoes not help. knife cookbook test <x>doesn't help, because syntactically it's correct. Is there a way to get it to print the exact line number causing the error? A recipe can contain 10 or 100 attributes, so this is a huge waste of time going through the lines to find a typo.
source
share