Chef Ideas

We believe that the best way to build software is to do it in close collaboration with the people who use it. We invite you to submit your ideas using the form below. Please be sure to include the problem for which you are solving and the benefits of implementing the idea.

We do our best to implement as many Ideas as we can. Our Product team will evaluate all submitted ideas in a timely manner and will disposition each into one of the following categories: will integrate into the product roadmap, further research is needed, unlikely to implement.

Thanks for collaborating with us!

`chef` Cookbook Template Validation Tool

As a Chef cookbook developer,

I would like an easy way to validate the syntax of a cookbook’s ERB templates,

So that I can have a shorter feedback loop into whether or not my ERB templates are valid, therefore increasing my velocity and hopefully raising the confidence in the cookbook I am trying to deploy

Yes, I am aware of the command erb -x -T '-' <filename> | ruby -c .. But what if my cookbook has 10s or 100s of ERB templates ?? Am I expected to run that command against each and everyone??

What I would really like is a command that allows me to ::

  • Test all of my cookbook’s ERB templates (<< would be awesome as part of a pipeline, just like `cookstyle`) OR

  • Test a specific cookbook ERB templates

For example ::

chef validate template << tests all ERB templates in a cookbook

chef validate template templates/hello.erb << tests a specific ERB template in a cookbook

I will leave it to the UX experts to decide what the interface should look like ..

Thanks !!


I tested the chef push command, and it does fail when there is an ERB syntax error .. So it appears a bad ERB cannot be uploaded to the Chef Server .. That said:

1) the error message is vague, even in debug mode

chef push dev -D

Uploading policy hello (a0d9d666e1) to policy group dev

[2019-10-04T10:04:49-04:00] FATAL: Erb template has a syntax error:

2) not all developers will have access to a usable Test Kitchen setup, meaning it would be the pipeline that catches these errors -- and in my humble opinion, that is already too late in the development process .. Again, goal is to shorten the feedback loop to increase the velocity of the Chef cookbook developer

3) what does validation look like in an Effortless world ?? Since I won't be using the chef push command -- what will validate that all my templates are of correct syntax before I commit code ?? chef install will install the cookbook locally even if there is invalid syntax in one of my templates ..

  • Gregory Spranger
  • Oct 3 2019
  • Currently Declined
  • Attach files
  • Tim Smith commented
    10 Feb, 2021 01:36am

    This would probably be best to handle in cookstyle and it would be a very useful feature there.