When uploading a file with a syntax error to chef-zero, the error message has an empty filename and doesn't actually display the syntax error.
Tested on both:
Start a chef-zero instance and create a cookbook with a single recipe with the following content:
cookbook_file "blah" do
source "blah"
mode "0644"
do
Try to upload the cookbook to the chef-zero server:
knife upload cookbooks/ --server-url http://localhost:<port> --chef-repo-path . --user dev -V
Expected:
Output similar to ruby -c recipes/test.rb:4: syntax error, unexpected keyword_do_block, expecting keyword_end
Actual:
No indication of which cookbook or recipe had the error, and no syntax error either:
INFO: Validating ruby files
FATAL: Cookbook file has a ruby syntax error:
cookbook_file "blah" do
source "blah"
mode "0644"
do
Looks a syntax error here it should be
cookbook_file "blah" do
source "blah"
mode "0644"
end
Closing it as it looks more of wrong syntax in the recipe as explained above. Feel free to open if there still an issue.
Hi @Vasu1105, the problem is not the syntax error, it is that chef zero suppresses the error message, so the user has no idea where the problem is. The bad code is just a way to reproduce the problem.
Most helpful comment
Hi @Vasu1105, the problem is not the syntax error, it is that chef zero suppresses the error message, so the user has no idea where the problem is. The bad code is just a way to reproduce the problem.